Skip to content

Instantly share code, notes, and snippets.

@rgpower
Created March 18, 2022 18:52
Show Gist options
  • Select an option

  • Save rgpower/3ba02c50bfa3abff3d37c185e76cdde5 to your computer and use it in GitHub Desktop.

Select an option

Save rgpower/3ba02c50bfa3abff3d37c185e76cdde5 to your computer and use it in GitHub Desktop.
add interpolation to env key/value pairs in values.yaml (helm)
env:
{{- if .Values.env -}}
{{- if gt (len .Values.env) 0 -}}
{{- range $k, $v := .Values.env }}
{{- if kindIs "string" $v }}
- name: {{ $k }}
value: {{ tpl ($v | toString) $ | quote }}
{{- else }}
- name: {{ $v.name }}
value: {{ tpl ($v.value | toString) $ | quote }}
{{- end }}
{{- else }}
[]
{{- end }}
{{- end -}}
{{- end -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment