🐛(helm) only use env: if envVars is defined

Previously, the `env:` key was always rendered in
Kubernetes manifests even when no environment
variables were defined, resulting in an empty
`env:` block. This wraps the entire `env:`
section in a conditional so it is only included
when `envVars` is actually set.

Signed-off-by: Johannes Kastl <[email protected]>
This commit is contained in:
Johannes Kastl
2026-03-06 12:24:12 +01:00
committed by Anthony LC
parent f155e9217e
commit 301bf43cb7
8 changed files with 17 additions and 17 deletions
@@ -38,10 +38,10 @@ items:
imagePullPolicy: {{ ($.Values.backend.image | default dict).pullPolicy | default $.Values.image.pullPolicy }}
args:
{{- toYaml .command | nindent 22 }}
{{- if $envVars}}
env:
{{- if $envVars}}
{{- $envVars | indent 22 }}
{{- end }}
{{- end }}
{{- with $.Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 22 }}
@@ -105,4 +105,4 @@ items:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
@@ -49,10 +49,10 @@ spec:
args:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $envVars}}
env:
{{- if $envVars}}
{{- $envVars | indent 12 }}
{{- end }}
{{- end }}
{{- with .Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
+2 -2
View File
@@ -44,10 +44,10 @@ spec:
args:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $envVars}}
env:
{{- if $envVars}}
{{- $envVars | indent 12 }}
{{- end }}
{{- end }}
{{- with .Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -48,10 +48,10 @@ spec:
args:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $envVars}}
env:
{{- if $envVars}}
{{- $envVars | indent 12 }}
{{- end }}
{{- end }}
{{- with .Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -48,10 +48,10 @@ spec:
args:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $envVars}}
env:
{{- if $envVars}}
{{- $envVars | indent 12 }}
{{- end }}
{{- end }}
{{- with .Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -49,10 +49,10 @@ spec:
args:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $envVars}}
env:
{{- if $envVars}}
{{- $envVars | indent 12 }}
{{- end }}
{{- end }}
{{- with .Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -49,10 +49,10 @@ spec:
args:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $envVars}}
env:
{{- if $envVars}}
{{- $envVars | indent 12 }}
{{- end }}
{{- end }}
{{- with .Values.frontend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
@@ -49,10 +49,10 @@ spec:
args:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $envVars}}
env:
{{- if $envVars}}
{{- $envVars | indent 12 }}
{{- end }}
{{- end }}
{{- with .Values.yProvider.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}