common-helm-lib/templates/parts/_env.tpl
Jonas Forsberg 0fe6d615a0
All checks were successful
Package and publish helm chart / package-helm (push) Successful in 14s
.
2024-10-22 14:29:12 +02:00

27 lines
825 B
Smarty

{{/*
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 -}}