common-helm-lib/templates/parts/_env.tpl

27 lines
825 B
Smarty
Raw Permalink Normal View History

2024-10-22 12:29:12 +00:00
{{/*
Get all environment variables configMaps and
secrets that should be mounted as environment variables
*/}}
{{- define "lib.parts.env" -}}
{{/*
environment variables from .Values.env
*/}}
{{- range $name, $value := .Values.env -}}
{{- printf "- name: %s" $name | nindent 0 }}
{{- printf "value: %s" $value | nindent 2 }}
{{- end -}}
{{/*
environment variables from configMaps
*/}}
{{- range $cfgName, $settings := .Values.configs -}}
{{- if and $settings.enabled $settings.env -}}
{{- range $key, $value := $settings.data -}}
{{- printf "- name: %s" $key | nindent 0 }}
{{- printf "valueFrom:" | nindent 2 }}
{{- printf "configMapKeyRef:" | nindent 4 }}
{{- printf "name: %s" $key | nindent 5 }}
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}