Skip to content

Commit 04c1ea4

Browse files
committed
🔧(helm) allow specific env var for the backend and celery deploy
We want the possibility to configure specific environment variables on backend and celery deployment. Most of them are common but in the case of the newly added settings DB_PSYCOPG_POOL_MIN_SIZE we want to configure ot only on the backend deployment, not on the celery or with a different value.
1 parent 130b8ae commit 04c1ea4

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to
2323
- 🐛(backend) create a link_trace record for on-boarding documents
2424
- 🐛(backend) manage race condition when creating sandbox document
2525
- ♿️(frontend) improve doc tree keyboard navigation #1981
26+
- 🔧(helm) allow specific env var for the backend and celery deploy
2627

2728
## [v4.7.0] - 2026-03-09
2829

src/helm/env.d/dev/values.impress.yaml.gotmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ backend:
7474
Y_PROVIDER_API_BASE_URL: http://impress-docs-y-provider:443/api/
7575
Y_PROVIDER_API_KEY: my-secret
7676
CACHES_KEY_PREFIX: "{{ now | unixEpoch }}"
77+
django:
78+
envVars:
79+
WEB_CONCURRENCY: 1
80+
DB_PSYCOPG_POOL_MIN_SIZE: 10
81+
82+
7783
migrate:
7884
command:
7985
- "/bin/sh"

src/helm/impress/templates/_helpers.tpl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ impress env vars
9090
{{- include "impress.env.transformDict" $workerScope.envVars -}}
9191
{{- end }}
9292

93+
{{/*
94+
impress backend django env vars - combines common backend.envVars with backend.django.envVars
95+
*/}}
96+
{{- define "impress.backend.django.env" -}}
97+
{{- $topLevelScope := index . 0 -}}
98+
{{- $workerScope := index . 1 -}}
99+
{{- include "impress.env.transformDict" $workerScope.envVars -}}
100+
{{- include "impress.env.transformDict" (($workerScope.django | default dict).envVars | default dict) -}}
101+
{{- end }}
102+
103+
{{/*
104+
impress celery env vars - combines common backend.envVars with backend.celery.envVars
105+
*/}}
106+
{{- define "impress.backend.celery.env" -}}
107+
{{- $topLevelScope := index . 0 -}}
108+
{{- $workerScope := index . 1 -}}
109+
{{- include "impress.env.transformDict" $workerScope.envVars -}}
110+
{{- include "impress.env.transformDict" ($workerScope.celery.envVars | default dict) -}}
111+
{{- end }}
112+
93113
{{/*
94114
Common labels
95115

src/helm/impress/templates/backend_deployment.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- $envVars := include "impress.common.env" (list . .Values.backend) -}}
1+
{{- $envVars := include "impress.backend.django.env" (list . .Values.backend) -}}
22
{{- $fullName := include "impress.backend.fullname" . -}}
33
{{- $component := "backend" -}}
44
apiVersion: apps/v1
@@ -53,9 +53,10 @@ spec:
5353
env:
5454
{{- $envVars | indent 12 }}
5555
{{- end }}
56-
{{- if .Values.backend.envFrom }}
56+
{{- $envFrom := concat (.Values.backend.envFrom | default list) ((.Values.backend.django | default dict).envFrom | default list) }}
57+
{{- if $envFrom }}
5758
envFrom:
58-
{{- toYaml .Values.backend.envFrom | nindent 12 }}
59+
{{- toYaml $envFrom | nindent 12 }}
5960
{{- end }}
6061
{{- with .Values.backend.securityContext }}
6162
securityContext:

src/helm/impress/templates/celery_worker_deployment.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- $envVars := include "impress.common.env" (list . .Values.backend) -}}
1+
{{- $envVars := include "impress.backend.celery.env" (list . .Values.backend) -}}
22
{{- $fullName := include "impress.celery.worker.fullname" . -}}
33
{{- $component := "celery-worker" -}}
44
apiVersion: apps/v1
@@ -53,9 +53,10 @@ spec:
5353
env:
5454
{{- $envVars | indent 12 }}
5555
{{- end }}
56-
{{- if .Values.backend.envFrom }}
56+
{{- $envFrom := concat (.Values.backend.envFrom | default list) (.Values.backend.celery.envFrom | default list) }}
57+
{{- if $envFrom }}
5758
envFrom:
58-
{{- toYaml .Values.backend.envFrom | nindent 12 }}
59+
{{- toYaml $envFrom | nindent 12 }}
5960
{{- end }}
6061
{{- with .Values.backend.securityContext }}
6162
securityContext:

src/helm/impress/values.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,21 @@ backend:
243243
envVars:
244244
<<: *commonEnvVars
245245

246-
## @skip backend.envFrom List of environment variables taken from Secrets or configMaps
246+
## @skip backend.envFrom List of environment variables taken from Secrets or configMaps, common to backend and celery worker
247247
envFrom: []
248248
# envFrom:
249249
# - secret:
250250
# name: super-secret-user-credentials
251251
# - configMapRef:
252252
# name: my-environment-variables
253253

254+
## @extra backend.django.envVars Backend web deployment specific environment variables (not shared with celery worker)
255+
## @skip backend.django.envVars
256+
## @skip backend.django.envFrom List of environment variables taken from Secrets or configMaps, specific to the backend web deployment
257+
django:
258+
envVars: {}
259+
envFrom: []
260+
254261
## @param backend.podAnnotations Annotations to add to the backend Pod
255262
podAnnotations: {}
256263

@@ -396,6 +403,9 @@ backend:
396403
## @param backend.celery.probes.readiness.exec.command Override the celery container readiness probe command
397404
## @param backend.celery.probes.readiness.initialDelaySeconds Initial delay for the celery container readiness probe
398405
## @param backend.celery.probes.readiness.timeoutSeconds Timeout for the celery container readiness probe
406+
## @extra backend.celery.envVars Celery worker specific environment variables (not shared with the backend web deployment)
407+
## @skip backend.celery.envVars
408+
## @skip backend.celery.envFrom List of environment variables taken from Secrets or configMaps, specific to celery worker
399409
celery:
400410
replicas: 1
401411
command: []
@@ -410,6 +420,8 @@ backend:
410420
"-n",
411421
"impress@%h",
412422
]
423+
envVars: {}
424+
envFrom: []
413425
resources: {}
414426
probes:
415427
liveness:

0 commit comments

Comments
 (0)