diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 7c1e202..10815b8 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -234,7 +234,7 @@ volumes: {{- else if eq ( default "self" $value.configMap.name ) "self-metadata" }} name: {{ include "common.fullname" ( dict "root" $root "service" $root.Values "serviceName" "metadata" ) }} {{- else }} - name: {{ $value.configMap.name }} + name: {{ default $value.configMap.name ( get $root.Values.global.configMapNameOverride $value.configMap.name ) | quote }} {{- end }} {{- with $value.configMap.items }} items: {{- . | toYaml | nindent 6 }} diff --git a/tests/expected.yaml b/tests/expected.yaml index 33cc4a4..8e1b280 100644 --- a/tests/expected.yaml +++ b/tests/expected.yaml @@ -630,6 +630,9 @@ spec: port: http volumes: + - name: config-map-override + configMap: + name: "test-overridden" - name: my-device-volume persistentVolumeClaim: claimName: pvc-name @@ -1014,6 +1017,11 @@ spec: image: "camptocamp/image:latest" imagePullPolicy: IfNotPresent env: + - name: "CONFIG_MAP_OVERRIDE" + valueFrom: + configMapKeyRef: + name: "test-overridden" + key: "testSingleLine" - name: "SELF_CONFIGMAP" valueFrom: configMapKeyRef: diff --git a/tests/values.yaml b/tests/values.yaml index d5fa669..1d73bfb 100644 --- a/tests/values.yaml +++ b/tests/values.yaml @@ -1,3 +1,7 @@ +global: + configMapNameOverride: + test-override: test-overridden + metadata: enabled: true @@ -250,6 +254,9 @@ services: items: - key: hostname path: hostname.txt + config-map-override: + configMap: + name: test-override service: &servicedefinition type: ClusterIP @@ -571,3 +578,7 @@ services: type: secret name: self-external-secret-app key: hostname + CONFIG_MAP_OVERRIDE: + type: configMap + name: test-override + key: testSingleLine