From 301bf43cb77b9e1387d33057578401e0711a01aa Mon Sep 17 00:00:00 2001 From: Johannes Kastl Date: Sat, 7 Feb 2026 17:00:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(helm)=20only=20use=20env:=20if=20e?= =?UTF-8?q?nvVars=20is=20defined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/helm/impress/templates/backend_cronjob_list.yaml | 6 +++--- src/helm/impress/templates/backend_deployment.yaml | 4 ++-- src/helm/impress/templates/backend_job.yml | 4 ++-- src/helm/impress/templates/backend_job_createsuperuser.yaml | 4 ++-- src/helm/impress/templates/backend_job_migrate.yaml | 4 ++-- src/helm/impress/templates/celery_worker_deployment.yaml | 4 ++-- src/helm/impress/templates/frontend_deployment.yaml | 4 ++-- src/helm/impress/templates/yprovider_deployment.yaml | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/helm/impress/templates/backend_cronjob_list.yaml b/src/helm/impress/templates/backend_cronjob_list.yaml index 5593eb3a..06b1af54 100644 --- a/src/helm/impress/templates/backend_cronjob_list.yaml +++ b/src/helm/impress/templates/backend_cronjob_list.yaml @@ -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 }} \ No newline at end of file +{{- end }} diff --git a/src/helm/impress/templates/backend_deployment.yaml b/src/helm/impress/templates/backend_deployment.yaml index afbd5eaa..f9bb002e 100644 --- a/src/helm/impress/templates/backend_deployment.yaml +++ b/src/helm/impress/templates/backend_deployment.yaml @@ -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 }} diff --git a/src/helm/impress/templates/backend_job.yml b/src/helm/impress/templates/backend_job.yml index 4888a904..117722f0 100644 --- a/src/helm/impress/templates/backend_job.yml +++ b/src/helm/impress/templates/backend_job.yml @@ -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 }} diff --git a/src/helm/impress/templates/backend_job_createsuperuser.yaml b/src/helm/impress/templates/backend_job_createsuperuser.yaml index 0096483c..40650b82 100644 --- a/src/helm/impress/templates/backend_job_createsuperuser.yaml +++ b/src/helm/impress/templates/backend_job_createsuperuser.yaml @@ -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 }} diff --git a/src/helm/impress/templates/backend_job_migrate.yaml b/src/helm/impress/templates/backend_job_migrate.yaml index 99e58ba1..981e3d9f 100644 --- a/src/helm/impress/templates/backend_job_migrate.yaml +++ b/src/helm/impress/templates/backend_job_migrate.yaml @@ -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 }} diff --git a/src/helm/impress/templates/celery_worker_deployment.yaml b/src/helm/impress/templates/celery_worker_deployment.yaml index 1c66404a..a372a8fb 100644 --- a/src/helm/impress/templates/celery_worker_deployment.yaml +++ b/src/helm/impress/templates/celery_worker_deployment.yaml @@ -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 }} diff --git a/src/helm/impress/templates/frontend_deployment.yaml b/src/helm/impress/templates/frontend_deployment.yaml index ddb0d12a..da994072 100644 --- a/src/helm/impress/templates/frontend_deployment.yaml +++ b/src/helm/impress/templates/frontend_deployment.yaml @@ -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 }} diff --git a/src/helm/impress/templates/yprovider_deployment.yaml b/src/helm/impress/templates/yprovider_deployment.yaml index 77dd79dd..549b2cd2 100644 --- a/src/helm/impress/templates/yprovider_deployment.yaml +++ b/src/helm/impress/templates/yprovider_deployment.yaml @@ -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 }}