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 2020/10/21 14:58:41 UTC
[skywalking-kubernetes] 01/01: Allow overriding arbitrary files
under /skywalking/config and only start es-init when the storage type is ES
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch refactor2
in repository https://gitbox.apache.org/repos/asf/skywalking-kubernetes.git
commit 9f39bc6ab40aa3c2557a0336912ffc959d61f370
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Wed Oct 21 22:58:21 2020 +0800
Allow overriding arbitrary files under /skywalking/config and only start es-init when the storage type is ES
---
chart/skywalking/templates/es-init.job.yaml | 5 +-
.../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 | 56 +++++-----------------
5 files changed, 16 insertions(+), 126 deletions(-)
diff --git a/chart/skywalking/templates/es-init.job.yaml b/chart/skywalking/templates/es-init.job.yaml
index 936e05b..8234552 100644
--- a/chart/skywalking/templates/es-init.job.yaml
+++ b/chart/skywalking/templates/es-init.job.yaml
@@ -14,6 +14,8 @@
# limitations under the License.
# https://docs.sentry.io/server/installation/docker/#running-migrations
+
+{{- if hasPrefix .Values.oap.storageType "elasticsearch" }}
apiVersion: batch/v1
kind: Job
metadata:
@@ -35,7 +37,7 @@ spec:
spec:
restartPolicy: Never
initContainers:
- {{- include "skywalking.containers.wait-for-es" . | nindent 6 }}
+ {{- include "skywalking.containers.wait-for-es" . | nindent 6 }}
containers:
- name: {{ .Values.oap.name }}
image: {{ .Values.oap.image.repository }}:{{ required "oap.image.tag is required" .Values.oap.image.tag }}
@@ -69,3 +71,4 @@ spec:
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
+{{- end}}
diff --git a/chart/skywalking/templates/oap-cm-override-application.yaml b/chart/skywalking/templates/oap-cm-override-application.yaml
deleted file mode 100644
index 329a0af..0000000
--- a/chart/skywalking/templates/oap-cm-override-application.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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
deleted file mode 100644
index 2242a71..0000000
--- a/chart/skywalking/templates/oap-cm-override-endpoint-name-grouping.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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
deleted file mode 100644
index 698e28c..0000000
--- a/chart/skywalking/templates/oap-cm-override-log4j2.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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 11dacd0..bafbcf0 100644
--- a/chart/skywalking/templates/oap-deployment.yaml
+++ b/chart/skywalking/templates/oap-deployment.yaml
@@ -77,7 +77,9 @@ spec:
{{ toYaml .Values.oap.tolerations | indent 8 }}
{{- end }}
initContainers:
- {{- include "skywalking.containers.wait-for-es" . | nindent 6 }}
+ {{- if hasPrefix .Values.oap.storageType "elasticsearch" }}
+ {{- include "skywalking.containers.wait-for-es" . | nindent 6 }}
+ {{- end }}
containers:
- name: {{ .Values.oap.name }}
image: {{ .Values.oap.image.repository }}:{{ required "oap.image.tag is required" .Values.oap.image.tag }}
@@ -103,7 +105,7 @@ spec:
{{- end }}
env:
- name: JAVA_OPTS
- value: "{{ .Values.oap.javaOpts }} -Dmode=no-init"
+ value: "-Dmode=no-init {{ .Values.oap.javaOpts }}"
- name: SW_CLUSTER
value: kubernetes
- name: SW_CLUSTER_K8S_NAMESPACE
@@ -144,51 +146,17 @@ spec:
{{- 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
+ {{- if (.Files.Glob "files/conf.d/oap/**") }}
+ {{ range $path, $bytes := .Files.Glob "files/conf.d/oap/**" }}
+ - name: skywalking-oap-override
+ mountPath: {{ print "/skywalking/config/" ($path | replace "files/conf.d/oap/" "") }}
+ subPath: {{ $path | replace "files/conf.d/oap/" "" | b64enc | replace "=" "-" }}
{{- 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
+ {{- if (.Files.Glob "files/conf.d/oap/**") }}
+ - name: skywalking-oap-override
configMap:
- name: {{ template "skywalking.fullname" . }}-override-endpoint-name-grouping-yml
+ name: {{ template "skywalking.fullname" . }}-oap-cm-override
{{- end }}