You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/11/21 14:11:10 UTC

[skywalking-kubernetes] 01/01: Remove `files/config.d` mechanism and use `values.yaml` files to put the configurations to override default config

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch config
in repository https://gitbox.apache.org/repos/asf/skywalking-kubernetes.git

commit d62b01d9c6c51a13eb66f1f4c2936b270ef5ccfe
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Mon Nov 21 22:10:59 2022 +0800

    Remove `files/config.d` mechanism and use `values.yaml` files to put the configurations to override default config
---
 CHANGES.md                                         | 11 +++++++++++
 chart/skywalking/files/conf.d/README.md            | 23 ----------------------
 chart/skywalking/files/conf.d/oap/.gitignore       |  1 -
 chart/skywalking/templates/oap-cm-override.yaml    | 21 +++++++++++++-------
 chart/skywalking/templates/oap-deployment.yaml     | 16 ++++++++++-----
 .../templates/satellite-cm-override.yaml           | 19 ++++++++++++------
 .../skywalking/templates/satellite-deployment.yaml | 16 ++++++++++-----
 chart/skywalking/values.yaml                       | 23 +++++++++++++++++++++-
 8 files changed, 82 insertions(+), 48 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 088fcb1..6a39918 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,17 @@ Changes by Version
 ==================
 Release Notes.
 
+4.4.0
+------------------
+
+- [**Breaking Change**]: remove `.Values.oap.initEs`, there is no need to use this to control whether to run init job anymore,
+  SkyWalking Helm Chart automatically delete the init job when installing/upgrading.
+- [**Breaking Change**]: remove `files/config.d` mechanism and use `values.yaml` files to put the configurations to override
+  default config files in the `/skywalking/config` folder, using `files/config.d` is very limited and you have to clone the source
+  codes if you want to use this mechanism, now you can simply use our [Docker Helm Chart](https://hub.docker.com/repository/docker/apache/skywalking-helm) to install.
+- Refactor oap init job, and support postgresql storage.
+- Upgrade ElasticSearch Helm Chart dependency version.
+
 4.3.0
 ------------------
 
diff --git a/chart/skywalking/files/conf.d/README.md b/chart/skywalking/files/conf.d/README.md
deleted file mode 100644
index 18d50ac..0000000
--- a/chart/skywalking/files/conf.d/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-If you don't want to use the default configuration files packed into the Docker image,
-put your own configuration files under this directory in the corresponding component subdirectory,
-`oap`, `ui`, etc.
-
-Files under `oap/*` will override the counterparts under the Docker image's `/skywalking/config/*`, with the directory structure retained, here are some examples:
-
-| File under `files/config.d/oap` directory | Overrides the file under Docker image's `/skywalking/config/` |
-| ---- | -------- |
-| `files/config.d/oap/application.yml`                 | `/skywalking/config/application.yml`                  |
-| `files/config.d/oap/log4j2.xml`                      | `/skywalking/config/log4j2.xml`                       |
-| `files/config.d/oap/alarm-settings.yml`              | `/skywalking/config/alarm-settings.yml`               |
-| `files/config.d/oap/endpoint-name-grouping.yml`      | `/skywalking/config/endpoint-name-grouping.yml`       |
-| `files/config.d/oap/oal/core.oal`                    | `/skywalking/config/oal/core.oal`                     |
-| `files/config.d/oap/oal/browser.oal`                 | `/skywalking/config/oal/browser.oal`                  |
-| `files/config.d/oap/oc-rules/oap.yaml`               | `/skywalking/config/oc-rules/oap.yaml`                |
-| `...`                                                | `...`                                                 |
-
-Files under `satellite/*` will override the counterparts under the Docker image's `/skywalking/configs/*`, with the directory structure retained, here are some examples:
-
-| File under `files/config.d/satellite` directory | Overrides the file under Docker image's `/skywalking/configs/` |
-| ---- | -------- |
-| `files/config.d/satellite/satellite_config.yaml` | `/skywalking/configs/satellite_config.yaml`  |
-| `...`                                            | `...`                                        |
diff --git a/chart/skywalking/files/conf.d/oap/.gitignore b/chart/skywalking/files/conf.d/oap/.gitignore
deleted file mode 100644
index 72e8ffc..0000000
--- a/chart/skywalking/files/conf.d/oap/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/chart/skywalking/templates/oap-cm-override.yaml b/chart/skywalking/templates/oap-cm-override.yaml
index d39b97d..2cf14ad 100644
--- a/chart/skywalking/templates/oap-cm-override.yaml
+++ b/chart/skywalking/templates/oap-cm-override.yaml
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-  {{- if (.Files.Glob "files/conf.d/oap/**") }}
+{{- if .Values.oap.config }}
 apiVersion: v1
 kind: ConfigMap
 metadata:
@@ -22,9 +22,16 @@ metadata:
     app: {{ template "skywalking.name" . }}
     release: {{ .Release.Name }}
     component: {{ .Values.oap.name }}
-binaryData:
-  {{ range $path, $bytes := .Files.Glob "files/conf.d/oap/**" }}
-  {{- $path | replace "files/conf.d/oap/" "" | b64enc | replace "=" "-" | indent 2 }}: |
-  {{ $.Files.Get $path | b64enc | indent 4 }}
-  {{ end }}
-  {{ end }}
+data:
+{{- range $path, $config := .Values.oap.config }}
+ {{- if typeIs "string" $config }}
+ {{ $path }}: |
+{{ $config | indent 4 }}
+ {{- else }}
+  {{- range $subpath, $subconfig := $config }}
+ {{ print $path "-" $subpath }}: |
+{{ $subconfig | indent 4 }}
+  {{- end }}
+ {{- end }}
+{{- end }}
+{{ end }}
diff --git a/chart/skywalking/templates/oap-deployment.yaml b/chart/skywalking/templates/oap-deployment.yaml
index 5406f64..6d330f5 100644
--- a/chart/skywalking/templates/oap-deployment.yaml
+++ b/chart/skywalking/templates/oap-deployment.yaml
@@ -131,16 +131,22 @@ spec:
         {{- end }}
 
         volumeMounts:
-          {{- if (.Files.Glob "files/conf.d/oap/**") }}
-          {{ range $path, $bytes := .Files.Glob "files/conf.d/oap/**" }}
+          {{- range $path, $config := .Values.oap.config }}
+          {{- if typeIs "string" $config }}
           - name: skywalking-oap-override
-            mountPath: {{ print "/skywalking/config/" ($path | replace "files/conf.d/oap/" "") }}
-            subPath: {{ $path | replace "files/conf.d/oap/" "" | b64enc | replace "=" "-" }}
+            mountPath: /skywalking/config/{{ $path }}
+            subPath: {{ $path }}
+          {{- else }}
+          {{- range $subpath, $oalContent := $config }}
+          - name: skywalking-oap-override
+            mountPath: /skywalking/config/{{ $path }}/{{ $subpath }}
+            subPath: {{ print $path "-" $subpath }}
+          {{- end }}
           {{- end }}
           {{- end }}
 
       volumes:
-        {{- if (.Files.Glob "files/conf.d/oap/**") }}
+        {{- if .Values.oap.config }}
         - name: skywalking-oap-override
           configMap:
             name: {{ template "skywalking.fullname" . }}-oap-cm-override
diff --git a/chart/skywalking/templates/satellite-cm-override.yaml b/chart/skywalking/templates/satellite-cm-override.yaml
index ed61bee..1533dee 100644
--- a/chart/skywalking/templates/satellite-cm-override.yaml
+++ b/chart/skywalking/templates/satellite-cm-override.yaml
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{- if (.Files.Glob "files/conf.d/satellite/**") }}
+{{- if .Values.satellite.config }}
 apiVersion: v1
 kind: ConfigMap
 metadata:
@@ -22,9 +22,16 @@ metadata:
     app: {{ template "skywalking.name" . }}
     release: {{ .Release.Name }}
     component: {{ .Values.satellite.name }}
-binaryData:
-  {{ range $path, $bytes := .Files.Glob "files/conf.d/satellite/**" }}
-  {{- $path | replace "files/conf.d/satellite/" "" | b64enc | replace "=" "-" | indent 2 }}: |
-  {{ $.Files.Get $path | b64enc | indent 4 }}
-  {{ end }}
+data:
+{{- range $path, $config := .Values.satellite.config }}
+ {{- if typeIs "string" $config }}
+ {{ $path }}: |
+{{ $config | indent 4 }}
+ {{- else }}
+  {{- range $subpath, $subconfig := $config }}
+ {{ print $path "-" $subpath }}: |
+{{ $subconfig | indent 4 }}
+  {{- end }}
+ {{- end }}
+{{- end }}
 {{ end }}
diff --git a/chart/skywalking/templates/satellite-deployment.yaml b/chart/skywalking/templates/satellite-deployment.yaml
index f17e78c..2659904 100644
--- a/chart/skywalking/templates/satellite-deployment.yaml
+++ b/chart/skywalking/templates/satellite-deployment.yaml
@@ -116,11 +116,17 @@ spec:
         {{- end }}
 
         volumeMounts:
-          {{- if (.Files.Glob "files/conf.d/satellite/**") }}
-          {{ range $path, $bytes := .Files.Glob "files/conf.d/satellite/**" }}
+          {{- range $path, $config := .Values.satellite.config }}
+          {{- if typeIs "string" $config }}
           - name: skywalking-satellite-override
-            mountPath: {{ print "/skywalking/configs/" ($path | replace "files/conf.d/satellite/" "") }}
-            subPath: {{ $path | replace "files/conf.d/satellite/" "" | b64enc | replace "=" "-" }}
+            mountPath: /skywalking/config/{{ $path }}
+            subPath: {{ $path }}
+          {{- else }}
+          {{- range $subpath, $oalContent := $config }}
+          - name: skywalking-satellite-override
+            mountPath: /skywalking/config/{{ $path }}/{{ $subpath }}
+            subPath: {{ print $path "-" $subpath }}
+          {{- end }}
           {{- end }}
           {{- end }}
 
@@ -130,4 +136,4 @@ spec:
           configMap:
             name: {{ template "skywalking.fullname" . }}-satellite-cm-override
         {{- end }}
-{{- end }}
\ No newline at end of file
+{{- end }}
diff --git a/chart/skywalking/values.yaml b/chart/skywalking/values.yaml
index 174eab6..6a4839e 100644
--- a/chart/skywalking/values.yaml
+++ b/chart/skywalking/values.yaml
@@ -37,7 +37,6 @@ oap:
     tag: null  # Must be set explicitly
     pullPolicy: IfNotPresent
   storageType: null
-  initEs: true # Whether need to initial ES
   ports:
     # add more ports here if you need, for example
     # zabbix: 10051
@@ -68,6 +67,23 @@ oap:
     # more env, please refer to https://hub.docker.com/r/apache/skywalking-oap-server
     # or https://github.com/apache/skywalking-docker/blob/master/6/6.4/oap/README.md#sw_telemetry
 
+  # Allows you to add any config files in /skywalking/config
+  # such as log4j2.xml, oal/core.oal, etc.
+  config:
+    # metadata-service-mapping.yaml: |
+    #   serviceName: e2e::${LABELS."service.istio.io/canonical-name"}
+    #   serviceInstanceName: ${NAME}
+    # oal:
+    #   core.oal: |
+    #     service_resp_time = from(Service.latency).longAvg();
+    #     service_sla = from(Service.*).percent(status == true);
+    #     service_cpm = from(Service.*).cpm();
+    # log4j2.xml: |
+    #   <Configuration status="DEBUG">
+    #     <!-- ... -->
+    #   </Configuration>
+
+
 ui:
   name: ui
   replicas: 1
@@ -413,6 +429,11 @@ satellite:
     # example: oap-foo
   env:
     # more env, please refer to https://skywalking.apache.org/docs/skywalking-satellite/latest/en/setup/readme/#satellite_configyaml
+  # Allows you to add any config files in /skywalking/config.
+  config:
+    # satellite_config.yaml: |
+    #   key: val
+
 
 nameOverride: ""
 fullnameOverride: ""