You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/10/18 09:16:15 UTC

[skywalking-kubernetes] branch master updated: Allow overriding the default configuration files (#56)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d1976e1  Allow overriding the default configuration files (#56)
d1976e1 is described below

commit d1976e1e630405b0b2fe5448bdbf03b8c94d4b2d
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Sun Oct 18 17:16:08 2020 +0800

    Allow overriding the default configuration files (#56)
    
    * Allow overriding the default configuration files
    
    * Polish the documentation
    
    * Add more overridable files
    
    * Add missing doc
    
    * Remove unnecessary file and ignore testing files
---
 README.md                                          | 11 ++++-
 chart/skywalking/files/conf.d/README.md            | 12 ++++++
 chart/skywalking/files/conf.d/oap/.gitignore       |  1 +
 .../oap-cm-override-alarm-settings-yml.yaml        | 27 ++++++++++++
 .../templates/oap-cm-override-application.yaml     | 27 ++++++++++++
 .../oap-cm-override-endpoint-name-grouping.yaml    | 27 ++++++++++++
 .../templates/oap-cm-override-log4j2.yaml          | 27 ++++++++++++
 chart/skywalking/templates/oap-deployment.yaml     | 50 ++++++++++++++++++++++
 8 files changed, 181 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 92b711f..08c7135 100644
--- a/README.md
+++ b/README.md
@@ -97,11 +97,20 @@ helm install "${SKYWALKING_RELEASE_NAME}" skywalking -n "${SKYWALKING_RELEASE_NA
   -f ./skywalking/values-my-es.yaml
 ```
 
-#### Pass environment variables to OAP
+#### Customization
+
+- Use your own configuration files
+
+Put your own configuration files according to [the overridable files](chart/skywalking/files/conf.d/README.md) under the
+working directory, `files/conf.d`, they will override the counterparts in the Docker image.
+
+- Pass environment variables to OAP
 
 The SkyWalking OAP exposes many configurations that can be specified by environment variables, as listed in [the main repo](https://github.com/apache/skywalking/blob/master/docs/en/setup/backend/configuration-vocabulary.md).
 You can set those environment variables by `--set oap.env.<ENV_NAME>=<ENV_VALUE>`, such as `--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh`.
 
+> The environment variables take priority over the overrode configuration files.
+
 # Contact Us
 * Submit an [issue](https://github.com/apache/skywalking/issues)
 * Mail list: **dev@skywalking.apache.org**. Mail to `dev-subscribe@skywalking.apache.org`, follow the reply to subscribe the mail list.
diff --git a/chart/skywalking/files/conf.d/README.md b/chart/skywalking/files/conf.d/README.md
new file mode 100644
index 0000000..02319e7
--- /dev/null
+++ b/chart/skywalking/files/conf.d/README.md
@@ -0,0 +1,12 @@
+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.
+
+For now, we support the following files which will override the counterparts in the Docker image.
+
+| File | Override |
+| ---- | -------- |
+| `oap/application.yml`                 | `/skywalking/config/application.yml`                  |
+| `oap/log4j2.xml`                      | `/skywalking/config/log4j2.xml`                       |
+| `oap/alarm-settings.yml`              | `/skywalking/config/alarm-settings.yml`               |
+| `oap/endpoint-name-grouping.yml`      | `/skywalking/config/endpoint-name-grouping.yml`       |
diff --git a/chart/skywalking/files/conf.d/oap/.gitignore b/chart/skywalking/files/conf.d/oap/.gitignore
new file mode 100644
index 0000000..72e8ffc
--- /dev/null
+++ b/chart/skywalking/files/conf.d/oap/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/chart/skywalking/templates/oap-cm-override-alarm-settings-yml.yaml b/chart/skywalking/templates/oap-cm-override-alarm-settings-yml.yaml
new file mode 100644
index 0000000..be03aee
--- /dev/null
+++ b/chart/skywalking/templates/oap-cm-override-alarm-settings-yml.yaml
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if (.Files.Glob "files/conf.d/oap/alarm-settings.yml") }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ template "skywalking.fullname" . }}-override-alarm-settings-yml
+  labels:
+    app: {{ template "skywalking.name" . }}
+    release: {{ .Release.Name }}
+    component: {{ .Values.oap.name }}
+data:
+{{ (.Files.Glob "files/conf.d/oap/alarm-settings.yml").AsConfig | indent 2 }}
+{{- end }}
diff --git a/chart/skywalking/templates/oap-cm-override-application.yaml b/chart/skywalking/templates/oap-cm-override-application.yaml
new file mode 100644
index 0000000..329a0af
--- /dev/null
+++ b/chart/skywalking/templates/oap-cm-override-application.yaml
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if (.Files.Glob "files/conf.d/oap/application.yml") }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ template "skywalking.fullname" . }}-override-application-yml
+  labels:
+    app: {{ template "skywalking.name" . }}
+    release: {{ .Release.Name }}
+    component: {{ .Values.oap.name }}
+data:
+{{ (.Files.Glob "files/conf.d/oap/application.yml").AsConfig | indent 2 }}
+{{- end }}
diff --git a/chart/skywalking/templates/oap-cm-override-endpoint-name-grouping.yaml b/chart/skywalking/templates/oap-cm-override-endpoint-name-grouping.yaml
new file mode 100644
index 0000000..2242a71
--- /dev/null
+++ b/chart/skywalking/templates/oap-cm-override-endpoint-name-grouping.yaml
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if (.Files.Glob "files/conf.d/oap/endpoint-name-grouping.yml") }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ template "skywalking.fullname" . }}-override-endpoint-name-grouping-yml
+  labels:
+    app: {{ template "skywalking.name" . }}
+    release: {{ .Release.Name }}
+    component: {{ .Values.oap.name }}
+data:
+{{ (.Files.Glob "files/conf.d/oap/endpoint-name-grouping.yml").AsConfig | indent 2 }}
+{{- end }}
diff --git a/chart/skywalking/templates/oap-cm-override-log4j2.yaml b/chart/skywalking/templates/oap-cm-override-log4j2.yaml
new file mode 100644
index 0000000..698e28c
--- /dev/null
+++ b/chart/skywalking/templates/oap-cm-override-log4j2.yaml
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if (.Files.Glob "files/conf.d/oap/log4j2.xml") }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ template "skywalking.fullname" . }}-override-log4j2-xml
+  labels:
+    app: {{ template "skywalking.name" . }}
+    release: {{ .Release.Name }}
+    component: {{ .Values.oap.name }}
+data:
+{{ (.Files.Glob "files/conf.d/oap/log4j2.xml").AsConfig | indent 2 }}
+{{- end }}
diff --git a/chart/skywalking/templates/oap-deployment.yaml b/chart/skywalking/templates/oap-deployment.yaml
index f88f2c5..11dacd0 100644
--- a/chart/skywalking/templates/oap-deployment.yaml
+++ b/chart/skywalking/templates/oap-deployment.yaml
@@ -142,3 +142,53 @@ spec:
         - name: {{ $key }}
           value: {{ $value | quote }}
         {{- end }}
+
+        volumeMounts:
+          {{- if (.Files.Glob "files/conf.d/oap/application.yml") }}
+          - name: skywalking-override-application-yml
+            mountPath: /skywalking/config/application.yml
+            subPath: application.yml
+          {{- end }}
+
+          {{- if (.Files.Glob "files/conf.d/oap/log4j2.xml") }}
+          - name: skywalking-override-log4j2-xml
+            mountPath: /skywalking/config/log4j2.xml
+            subPath: log4j2.xml
+          {{- end }}
+
+          {{- if (.Files.Glob "files/conf.d/oap/alarm-settings.yml") }}
+          - name: skywalking-override-alarm-settings-yml
+            mountPath: /skywalking/config/alarm-settings.yml
+            subPath: alarm-settings.yml
+          {{- end }}
+
+          {{- if (.Files.Glob "files/conf.d/oap/endpoint-name-grouping.yml") }}
+          - name: skywalking-override-endpoint-name-grouping-yml
+            mountPath: /skywalking/config/endpoint-name-grouping.yml
+            subPath: endpoint-name-grouping.yml
+          {{- end }}
+
+      volumes:
+        {{- if (.Files.Glob "files/conf.d/oap/application.yml") }}
+        - name: skywalking-override-application-yml
+          configMap:
+            name: {{ template "skywalking.fullname" . }}-override-application-yml
+        {{- end }}
+
+        {{- if (.Files.Glob "files/conf.d/oap/log4j2.xml") }}
+        - name: skywalking-override-log4j2-xml
+          configMap:
+            name: {{ template "skywalking.fullname" . }}-override-log4j2-xml
+        {{- end }}
+
+        {{- if (.Files.Glob "files/conf.d/oap/alarm-settings.yml") }}
+        - name: skywalking-override-alarm-settings-yml
+          configMap:
+            name: {{ template "skywalking.fullname" . }}-override-alarm-settings-yml
+        {{- end }}
+
+        {{- if (.Files.Glob "files/conf.d/oap/endpoint-name-grouping.yml") }}
+        - name: skywalking-override-endpoint-name-grouping-yml
+          configMap:
+            name: {{ template "skywalking.fullname" . }}-override-endpoint-name-grouping-yml
+        {{- end }}