(helm) allow keys in configMap or secret as env var

The current envVars construct only allows single
keys in a configMap or secret to be used as
environment variables.
This commits keeps this functionality for
backwards compatibility, but adds another
envFrom variable that allows using all keys in a
secret or configMap as environment variables.

Signed-off-by: Johannes Kastl <git@johannes-kastl.de>
This commit is contained in:
Johannes Kastl
2026-02-07 17:07:22 +01:00
committed by Anthony LC
parent 301bf43cb7
commit b4591cda10
6 changed files with 52 additions and 0 deletions
@@ -53,6 +53,10 @@ spec:
env:
{{- $envVars | indent 12 }}
{{- end }}
{{- if .Values.backend.envFrom }}
envFrom:
{{- toYaml .Values.backend.envFrom | nindent 12 }}
{{- end }}
{{- with .Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -53,6 +53,10 @@ spec:
env:
{{- $envVars | indent 12 }}
{{- end }}
{{- if .Values.backend.envFrom }}
envFrom:
{{- toYaml .Values.backend.envFrom | nindent 12 }}
{{- end }}
{{- with .Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -39,6 +39,10 @@ spec:
env:
{{- $envVars | indent 12 }}
{{- end }}
{{- if .Values.backend.envFrom }}
envFrom:
{{- toYaml .Values.backend.envFrom | nindent 12 }}
{{- end }}
{{- with .Values.docSpec.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -53,6 +53,10 @@ spec:
env:
{{- $envVars | indent 12 }}
{{- end }}
{{- if .Values.frontend.envFrom }}
envFrom:
{{- toYaml .Values.frontend.envFrom | nindent 12 }}
{{- end }}
{{- with .Values.frontend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -53,6 +53,10 @@ spec:
env:
{{- $envVars | indent 12 }}
{{- end }}
{{- if .Values.yProvider.envFrom }}
envFrom:
{{- toYaml .Values.yProvider.envFrom | nindent 12 }}
{{- end }}
{{- with .Values.yProvider.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
+32
View File
@@ -243,6 +243,14 @@ backend:
envVars:
<<: *commonEnvVars
## @skip backend.envFrom List of environment variables taken from Secrets or configMaps
envFrom: []
# envFrom:
# - secret:
# name: super-secret-user-credentials
# - configMapRef:
# name: my-environment-variables
## @param backend.podAnnotations Annotations to add to the backend Pod
podAnnotations: {}
@@ -471,6 +479,14 @@ frontend:
envVars:
<<: *commonEnvVars
## @skip frontend.envFrom List of environment variables taken from Secrets or configMaps
envFrom: []
# envFrom:
# - secret:
# name: super-secret-user-credentials
# - configMapRef:
# name: my-environment-variables
## @param frontend.podAnnotations Annotations to add to the frontend Pod
podAnnotations: {}
@@ -648,6 +664,14 @@ yProvider:
envVars:
<<: *commonEnvVars
## @skip yProvider.envFrom List of environment variables taken from Secrets or configMaps
envFrom: []
# envFrom:
# - secret:
# name: super-secret-user-credentials
# - configMapRef:
# name: my-environment-variables
## @param yProvider.podAnnotations Annotations to add to the yProvider Pod
podAnnotations: {}
@@ -749,6 +773,14 @@ docSpec:
## @param docSpec.envVars Configure docSpec container environment variables
envVars: {}
## @skip docSpec.envFrom List of environment variables taken from Secrets or configMaps
envFrom: []
# envFrom:
# - secret:
# name: super-secret-user-credentials
# - configMapRef:
# name: my-environment-variables
## @param docSpec.service Configure docSpec service
service:
type: ClusterIP