From 7c026accfb1992168fc909199baa3df932d60bba Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 6 Jun 2022 22:42:14 +0200 Subject: [PATCH] solution 1 --- .../templates/lib/controller/_container.tpl | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/charts/common/templates/lib/controller/_container.tpl b/charts/common/templates/lib/controller/_container.tpl index ab2033ed..95a59c05 100644 --- a/charts/common/templates/lib/controller/_container.tpl +++ b/charts/common/templates/lib/controller/_container.tpl @@ -90,6 +90,16 @@ {{- if kindIs "map" $value -}} {{- if hasKey $value "value" }} {{- $value = $value.value -}} + {{- else if hasKey $value "secretKeyRef" }} + valueFrom: + secretKeyRef: + name: {{ tpl $value.secretKeyRef.name $ | quote }} + key: {{ tpl $value.secretKeyRef.key $ | quote }} + {{- else if hasKey $value "configMapRef" }} + valueFrom: + configMapRef: + name: {{ tpl $value.configMapRef.name $ | quote }} + key: {{ tpl $value.configMapRef.key $ | quote }} {{- else if hasKey $value "valueFrom" }} {{- dict "valueFrom" $value.valueFrom | toYaml | nindent 6 }} {{- else }} @@ -104,21 +114,6 @@ {{- end }} {{- end }} {{- end }} - {{- range $key, $value := .Values.envValueFrom }} - - name: {{ $key }} - valueFrom: - {{- if $value.secretKeyRef }} - secretKeyRef: - name: {{ tpl $value.secretKeyRef.name $ | quote }} - key: {{ tpl $value.secretKeyRef.key $ | quote }} - {{- else if $value.configMapRef }} - configMapRef: - name: {{ tpl $value.configMapRef.name $ | quote }} - key: {{ tpl $value.configMapRef.key $ | quote }} - {{- else }} - {{- $value | toYaml | nindent 8 }} - {{- end }} - {{- end }} {{- range $envList := .Values.envList }} {{- if and $envList.name $envList.value }} - name: {{ $envList.name }}