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

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


The following commit(s) were added to refs/heads/master by this push:
     new e55e80e  fix: inconsistency in volumes/volumeMounts between oap and 
init job
e55e80e is described below

commit e55e80ea3f48635f7fc7b62741d9022a7842b108
Author: Noodles Wang <noodles.w...@mercaso.com>
AuthorDate: Thu Jul 31 19:01:54 2025 +0800

    fix: inconsistency in volumes/volumeMounts between oap and init job
---
 chart/skywalking/templates/_helpers.tpl        | 53 ++++++++++++++++++++++++++
 chart/skywalking/templates/oap-deployment.yaml | 43 +--------------------
 chart/skywalking/templates/oap-init.job.yaml   | 35 +----------------
 3 files changed, 57 insertions(+), 74 deletions(-)

diff --git a/chart/skywalking/templates/_helpers.tpl 
b/chart/skywalking/templates/_helpers.tpl
index 8bc0e79..1d9c496 100644
--- a/chart/skywalking/templates/_helpers.tpl
+++ b/chart/skywalking/templates/_helpers.tpl
@@ -216,3 +216,56 @@ Define the banyandb grpc port
 {{- .Values.banyandb.cluster.liaison.grpcSvc.port -}}
 {{- end -}}
 {{- end -}}
+
+{{/*
+Define volumeMounts for OAP containers
+*/}}
+{{- define "skywalking.oap.volumeMounts" -}}
+{{- range $path, $config := .Values.oap.config }}
+{{- if typeIs "string" $config }}
+- name: skywalking-oap-override
+  mountPath: /skywalking/config/{{ $path }}
+  subPath: {{ $path }}
+{{- else }}
+{{- range $subpath, $subconfig := $config }}
+{{- if typeIs "string" $subconfig }}
+- name: skywalking-oap-override
+  mountPath: /skywalking/config/{{ $path }}/{{ $subpath }}
+  subPath: {{ print $path "-" $subpath }}
+{{- else }}
+{{- range $subsubpath, $subsubconfig := $subconfig }}
+- name: skywalking-oap-override
+  mountPath: /skywalking/config/{{ $path }}/{{ $subpath }}/{{ $subsubpath }}
+  subPath: {{ print $path "-" $subpath "-" $subsubpath }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- range .Values.oap.secretMounts }}
+- name: {{ .name }}
+  mountPath: {{ .path }}
+  {{- if .subPath }}
+  subPath: {{ .subPath }}
+  {{- end }}
+{{- end }}
+{{- end -}}
+
+{{/*
+Define volumes for OAP containers
+*/}}
+{{- define "skywalking.oap.volumes" -}}
+{{- if .Values.oap.config }}
+- name: skywalking-oap-override
+  configMap:
+    name: {{ template "skywalking.fullname" . }}-oap-cm-override
+{{- end }}
+{{- range .Values.oap.secretMounts }}
+- name: {{ .name }}
+  secret:
+    secretName: {{ .secretName }}
+    {{- if .defaultMode }}
+    defaultMode: {{ .defaultMode }}
+    {{- end }}
+{{- end }}
+{{- end -}}
diff --git a/chart/skywalking/templates/oap-deployment.yaml 
b/chart/skywalking/templates/oap-deployment.yaml
index 7b32bbb..de076e4 100644
--- a/chart/skywalking/templates/oap-deployment.yaml
+++ b/chart/skywalking/templates/oap-deployment.yaml
@@ -164,46 +164,7 @@ spec:
         {{- end }}
 
         volumeMounts:
-          {{- range $path, $config := .Values.oap.config }}
-          {{- if typeIs "string" $config }}
-          - name: skywalking-oap-override
-            mountPath: /skywalking/config/{{ $path }}
-            subPath: {{ $path }}
-          {{- else }}
-          {{- range $subpath, $subconfig := $config }}
-          {{- if typeIs "string" $subconfig }}
-          - name: skywalking-oap-override
-            mountPath: /skywalking/config/{{ $path }}/{{ $subpath }}
-            subPath: {{ print $path "-" $subpath }}
-          {{- else }}
-          {{- range $subsubpath, $subsubconfig := $subconfig }}
-          - name: skywalking-oap-override
-            mountPath: /skywalking/config/{{ $path }}/{{ $subpath }}/{{ 
$subsubpath }}
-            subPath: {{ print $path "-" $subpath "-" $subsubpath }}
-          {{- end }}
-          {{- end }}
-          {{- end }}
-          {{- end }}
-          {{- end }}
-          {{- range .Values.oap.secretMounts }}
-          - name: {{ .name }}
-            mountPath: {{ .path }}
-            {{- if .subPath }}
-            subPath: {{ .subPath }}
-            {{- end }}
-          {{- end }}
+        {{- include "skywalking.oap.volumeMounts" . | nindent 8 }}
 
       volumes:
-        {{- if .Values.oap.config }}
-        - name: skywalking-oap-override
-          configMap:
-            name: {{ template "skywalking.fullname" . }}-oap-cm-override
-        {{- end }}
-        {{- range .Values.oap.secretMounts }}
-        - name: {{ .name }}
-          secret:
-            secretName: {{ .secretName }}
-            {{- if .defaultMode }}
-            defaultMode: {{ .defaultMode }}
-          {{- end }}
-        {{- end }}
+      {{- include "skywalking.oap.volumes" . | nindent 6 }}
diff --git a/chart/skywalking/templates/oap-init.job.yaml 
b/chart/skywalking/templates/oap-init.job.yaml
index 3b1a22d..2bf1874 100644
--- a/chart/skywalking/templates/oap-init.job.yaml
+++ b/chart/skywalking/templates/oap-init.job.yaml
@@ -85,38 +85,7 @@ spec:
         {{- end }}
 
         volumeMounts:
-          {{- range $path, $config := .Values.oap.config }}
-          {{- if typeIs "string" $config }}
-          - name: skywalking-oap-override
-            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 }}
-          {{- range .Values.oap.secretMounts }}
-          - name: {{ .name }}
-            mountPath: {{ .path }}
-            {{- if .subPath }}
-            subPath: {{ .subPath }}
-            {{- end }}
-          {{- end }}
+        {{- include "skywalking.oap.volumeMounts" . | nindent 8 }}
 
       volumes:
-        {{- if .Values.oap.config }}
-        - name: skywalking-oap-override
-          configMap:
-            name: {{ template "skywalking.fullname" . }}-oap-cm-override
-        {{- end }}
-        {{- range .Values.oap.secretMounts }}
-        - name: {{ .name }}
-          secret:
-            secretName: {{ .secretName }}
-            {{- if .defaultMode }}
-            defaultMode: {{ .defaultMode }}
-            {{- end }}
-        {{- end }}
+      {{- include "skywalking.oap.volumes" . | nindent 6 }}

Reply via email to