Skip to content

Commit 29f53c5

Browse files
committed
feat: Add extraEnvFrom for mounting multiple secrets/cms
This feature allows users to specify a list of `secretRef` or `configMapRef` objects which should be added to the `envFrom` field in the Invenio containers. This reduces the need for repeating the name and value of each environment variable that the user wants to add; instead they can simply define them all in one or more secrets/configmaps and let `envFrom` do the work of adding each variable to the container's environment.
1 parent b45778d commit 29f53c5

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed

charts/invenio/templates/flower/deployment.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ spec:
4444
secretKeyRef:
4545
name: {{ .Values.flower.secret_name }}
4646
key: FLOWER_BASIC_AUTH_CREDENTIALS
47+
{{- if (or .Values.invenio.extraEnvFrom .Values.flower.extraEnvFrom) }}
48+
envFrom:
49+
{{- with .Values.invenio.extraEnvFrom }}
50+
{{- . | toYaml | nindent 12 }}
51+
{{- end }}
52+
{{- with .Values.flower.extraEnvFrom }}
53+
{{- . | toYaml | nindent 12 }}
54+
{{- end }}
55+
{{- end }}
4756
{{- if .Values.flower.resources }}
4857
resources: {{- toYaml .Values.flower.resources | nindent 12 }}
4958
{{- end }}

charts/invenio/templates/web-deployment.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ spec:
3333
name: {{ include "invenio.fullname" . }}-config
3434
- secretRef:
3535
name: {{ include "invenio.secretName" . }}
36+
{{- with .Values.invenio.extraEnvFrom }}
37+
{{- . | toYaml | nindent 8 }}
38+
{{- end }}
39+
{{- with .Values.web.extraEnvFrom }}
40+
{{- . | toYaml | nindent 8 }}
41+
{{- end }}
3642
env:
3743
- name: TZ
3844
value: {{ required "Missing .Values.global.timezone" .Values.global.timezone }}

charts/invenio/templates/worker-beat-deployment.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ spec:
4545
name: {{ include "invenio.fullname" . }}-config
4646
- secretRef:
4747
name: {{ include "invenio.secretName" . }}
48+
{{- with .Values.invenio.extraEnvFrom }}
49+
{{- . | toYaml | nindent 8 }}
50+
{{- end }}
51+
{{- with .Values.workerBeat.extraEnvFrom }}
52+
{{- . | toYaml | nindent 8 }}
53+
{{- end }}
4854
env:
4955
- name: TZ
5056
value: {{ required "Missing .Values.global.timezone" .Values.global.timezone }}

charts/invenio/templates/worker-deployment.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ spec:
3636
name: {{ include "invenio.fullname" . }}-config
3737
- secretRef:
3838
name: {{ include "invenio.secretName" . }}
39+
{{- with .Values.invenio.extraEnvFrom }}
40+
{{- . | toYaml | nindent 12 }}
41+
{{- end }}
42+
{{- with .Values.worker.extraEnvFrom }}
43+
{{- . | toYaml | nindent 12 }}
44+
{{- end }}
3945
env:
4046
- name: TZ
4147
value: {{ required "Missing .Values.global.timezone" .Values.global.timezone }}

charts/invenio/values.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ invenio:
8585
# name: name-of-my-secret
8686
# key: KEY_IN_MY_SECRET
8787
uwsgiExtraConfig: {}
88+
## @param invenio.extraEnvFrom Extra secretRef or configMapRef for the `envFrom` field in all Invenio containers
89+
##
90+
extraEnvFrom: []
91+
# - secretRef:
92+
# name: foo
93+
# - configMapRef:
94+
# name: bar
8895

8996
## @param invenio.vocabularies Vocabularies to be loaded as files under /app_data/vocabularies
9097
## Example
@@ -234,6 +241,13 @@ web:
234241
capabilities:
235242
drop:
236243
- ALL
244+
## @param web.extraEnvFrom Extra secretRef or configMapRef for the `envFrom` field in the web container
245+
##
246+
extraEnvFrom: []
247+
# - secretRef:
248+
# name: foo
249+
# - configMapRef:
250+
# name: bar
237251

238252
worker:
239253
enabled: true
@@ -273,6 +287,13 @@ worker:
273287
capabilities:
274288
drop:
275289
- ALL
290+
## @param worker.extraEnvFrom Extra secretRef or configMapRef for the `envFrom` field in the worker container
291+
##
292+
extraEnvFrom: []
293+
# - secretRef:
294+
# name: foo
295+
# - configMapRef:
296+
# name: bar
276297

277298
workerBeat:
278299
## @param workerBeat.extraEnvVars Extra environment variables (templated) to be added to the pods.
@@ -300,6 +321,13 @@ workerBeat:
300321
runAsGroup: 1000
301322
seccompProfile:
302323
type: "RuntimeDefault"
324+
## @param workerBeat.extraEnvFrom Extra secretRef or configMapRef for the `envFrom` field in the worker-beat container
325+
##
326+
extraEnvFrom: []
327+
# - secretRef:
328+
# name: foo
329+
# - configMapRef:
330+
# name: bar
303331

304332
persistence:
305333
enabled: true
@@ -361,6 +389,13 @@ flower:
361389
limits:
362390
memory: 250Mi
363391
cpu: 0.1
392+
## @param flower.extraEnvFrom Extra secretRef or configMapRef for the `envFrom` field in the flower container
393+
##
394+
extraEnvFrom: []
395+
# - secretRef:
396+
# name: foo
397+
# - configMapRef:
398+
# name: bar
364399

365400
postgresql:
366401
enabled: true

0 commit comments

Comments
 (0)