Hello
I would like to have a single environment section in my values file where I can define both the usual environment type and the secretRef environment type.
Is it possible to achieve this via templating?
Example what I’m trying to achieve
env:
ADDRESS: http://some.url
FETCH-INTERVAL: 1m
USERNAME:
secretName: some_secret
key: username
PASSWORD:
secretName: some_secret
key: password
Here is what i have at this moment in my templatefile
env:
{{- if .Values.env }}
{{- range $k, $v := .Values.env }}
- name: {{ $k | quote }}
{{- if eq $v.type "secretRef" }}
valueFrom:
secretKeyRef:
name: {{ $v.name | quote }}
key: {{ $v.key | quote }}
{{- else if eq $v.type "configMapRef" }}
valueFrom:
configMapKeyRef:
name: {{ $v.name | quote }}
key: {{ $v.key | quote }}
{{- else }}
value: {{ $v.value | quote }}
{{- end }}
{{- end }}
{{- end }}
env:
ADDRESS:
type: string
value: http://some.url
FETCH-INTERVAL:
type: string
value: 1m
USERNAME:
type: secretRef
name: some_secret
key: username
PASSWORD:
type: secretRef
name: some_secret
key: password
It works, but in this case, I always need to set the env type, and it’s not I’m trying to achieve