Skip to content

Commit ec5dd85

Browse files
**Summary:**
- Add extraInitContainers to celery+django deployments. - Add extraEnv to all deployments - Remove existing volume logic in favor of agnostic extraVolumes and extraVolumeMounts - Fix optional secret mounts + reference - Update bitnami chart reference (OCI) - Bump up redis chart
1 parent a406968 commit ec5dd85

File tree

9 files changed

+137
-214
lines changed

9 files changed

+137
-214
lines changed

helm/defectdojo/Chart.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
dependencies:
22
- name: postgresql
3-
repository: https://charts.bitnami.com/bitnami
4-
version: 16.7.0
3+
repository: oci://registry-1.docker.io/bitnamicharts
4+
version: 16.7.13
55
- name: redis
6-
repository: https://charts.bitnami.com/bitnami
7-
version: 19.6.4
8-
digest: sha256:20147b5ef71e728a24b1ce410bfbc64885bb824bac17d75dc3ad49e9af5f1b01
9-
generated: "2025-05-08T15:21:14.221601771Z"
6+
repository: oci://registry-1.docker.io/bitnamicharts
7+
version: 21.2.5
8+
digest: sha256:e7440eab01608ec924098f92de7c077f43595776275ef6e96df6d2dc1b2156f4
9+
generated: "2025-06-25T13:39:17.038667777+02:00"

helm/defectdojo/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ maintainers:
1111
dependencies:
1212
- name: postgresql
1313
version: ~16.7.0
14-
repository: "https://charts.bitnami.com/bitnami"
14+
repository: oci://registry-1.docker.io/bitnamicharts
1515
condition: postgresql.enabled
1616
- name: redis
17-
version: ~19.6.0
18-
repository: "https://charts.bitnami.com/bitnami"
17+
version: ~21.2.5
18+
repository: oci://registry-1.docker.io/bitnamicharts
1919
condition: redis.enabled

helm/defectdojo/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Create the name of the service account to use
6161
{{- if .Values.redis.enabled -}}
6262
{{- printf "%s-%s" .Release.Name "redis-master" | trunc 63 | trimSuffix "-" -}}
6363
{{- else -}}
64-
{{- printf "%s" (.Values.celery.brokerHost | default .Values.redis.redisServer) -}}
64+
{{- .Values.celery.brokerHost }}
6565
{{- end -}}
6666
{{- end -}}
6767
{{- end -}}

helm/defectdojo/templates/celery-beat-deployment.yaml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,16 @@ spec:
7171
configMap:
7272
name: {{ .Values.django.uwsgi.certificates.configName }}
7373
{{- end }}
74-
{{- range .Values.celery.extraVolumes }}
75-
- name: userconfig-{{ .name }}
76-
{{ .type }}:
77-
{{- if (eq .type "configMap") }}
78-
name: {{ .name }}
79-
{{- else if (eq .type "secret") }}
80-
secretName: {{ .name }}
81-
{{- else if (eq .type "hostPath") }}
82-
type: {{ .pathType | default "Directory" }}
83-
path: {{ .hostPath }}
84-
{{- end }}
74+
{{- with .Values.celery.beat.extraVolumes }}
75+
{{- . | toYaml | nindent 6 }}
8576
{{- end }}
86-
{{- if or .Values.dbMigrationChecker.enabled .Values.cloudsql.enabled }}
77+
{{- if coalesce .Values.dbMigrationChecker.enabled .Values.cloudsql.enabled .Values.celery.beat.extraInitContainers }}
8778
initContainers:
79+
{{- range .Values.celery.beat.extraInitContainers }}
80+
- {{- . | toYaml | nindent 8 }}
8881
{{- end }}
89-
{{- if .Values.cloudsql.enabled }}
82+
{{- end }}
83+
{{- if .Values.cloudsql.enabled }}
9084
- name: cloudsql-proxy
9185
image: {{ .Values.cloudsql.image.repository }}:{{ .Values.cloudsql.image.tag }}
9286
imagePullPolicy: {{ .Values.cloudsql.image.pullPolicy }}
@@ -115,6 +109,15 @@ spec:
115109
name: celery
116110
image: "{{ template "celery.repository" . }}:{{ .Values.tag }}"
117111
imagePullPolicy: {{ .Values.imagePullPolicy }}
112+
{{- with .Values.celery.beat.livenessProbe }}
113+
livenessProbe: {{ toYaml . | nindent 10 }}
114+
{{- end }}
115+
{{- with .Values.celery.beat.readinessProbe }}
116+
readinessProbe: {{ toYaml . | nindent 10 }}
117+
{{- end }}
118+
{{- with .Values.celery.beat.startupProbe }}
119+
startupProbe: {{ toYaml . | nindent 10 }}
120+
{{- end }}
118121
{{- if .Values.securityContext.enabled }}
119122
securityContext:
120123
{{- toYaml .Values.securityContext.djangoSecurityContext | nindent 10 }}
@@ -128,15 +131,12 @@ spec:
128131
mountPath: /app/dojo/settings/local_settings.py
129132
subPath: file
130133
{{- end }}
131-
{{- if .Values.django.uwsgi.certificates.enabled }}
134+
{{- if .Values.django.uwsgi.certificates.enabled }}
132135
- name: cert-mount
133136
mountPath: {{ .Values.django.uwsgi.certificates.certMountPath }}
134137
{{- end }}
135-
{{- range .Values.celery.extraVolumes }}
136-
- name: userconfig-{{ .name }}
137-
readOnly: true
138-
mountPath: {{ .path }}
139-
subPath: {{ .subPath }}
138+
{{- with .Values.celery.beat.extraVolumeMounts }}
139+
{{- . | toYaml | nindent 8 }}
140140
{{- end }}
141141
envFrom:
142142
- configMapRef:
@@ -162,8 +162,8 @@ spec:
162162
secretKeyRef:
163163
name: {{ $fullName }}
164164
key: DD_SECRET_KEY
165-
{{- with .Values.extraEnv }}
166-
{{- toYaml . | nindent 8 }}
165+
{{- with .Values.celery.beat.extraEnv }}
166+
{{- . | toYaml | nindent 8 }}
167167
{{- end }}
168168
resources:
169169
{{- toYaml .Values.celery.beat.resources | nindent 10 }}

helm/defectdojo/templates/celery-worker-deployment.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,14 @@ spec:
6969
configMap:
7070
name: {{ .Values.django.uwsgi.certificates.configName }}
7171
{{- end }}
72-
{{- range .Values.celery.extraVolumes }}
73-
- name: userconfig-{{ .name }}
74-
{{ .type }}:
75-
{{- if (eq .type "configMap") }}
76-
name: {{ .name }}
77-
{{- else if (eq .type "secret") }}
78-
secretName: {{ .name }}
79-
{{- else if (eq .type "hostPath") }}
80-
type: {{ .pathType | default "Directory" }}
81-
path: {{ .hostPath }}
82-
{{- end }}
72+
{{- with .Values.celery.beat.extraVolumes }}
73+
{{- . | toYaml | nindent 6 }}
8374
{{- end }}
84-
{{- if or .Values.dbMigrationChecker.enabled .Values.cloudsql.enabled }}
75+
{{- if coalesce .Values.dbMigrationChecker.enabled .Values.cloudsql.enabled .Values.celery.worker.extraInitContainers }}
8576
initContainers:
77+
{{- range .Values.celery.worker.extraInitContainers }}
78+
- {{- . | toYaml | nindent 8 }}
79+
{{- end }}
8680
{{- end }}
8781
{{- if .Values.cloudsql.enabled }}
8882
- name: cloudsql-proxy
@@ -111,13 +105,22 @@ spec:
111105
- name: celery
112106
image: "{{ template "celery.repository" . }}:{{ .Values.tag }}"
113107
imagePullPolicy: {{ .Values.imagePullPolicy }}
108+
{{- with .Values.celery.worker.livenessProbe }}
109+
livenessProbe: {{ toYaml . | nindent 10 }}
110+
{{- end }}
111+
{{- with .Values.celery.worker.readinessProbe }}
112+
readinessProbe: {{ toYaml . | nindent 10 }}
113+
{{- end }}
114+
{{- with .Values.celery.worker.startupProbe }}
115+
startupProbe: {{ toYaml . | nindent 10 }}
116+
{{- end }}
114117
{{- if .Values.securityContext.enabled }}
115118
securityContext:
116119
{{- toYaml .Values.securityContext.djangoSecurityContext | nindent 10 }}
117120
{{- end }}
118121
command: ['/entrypoint-celery-worker.sh']
119122
volumeMounts:
120-
{{- if .Values.localsettingspy }}
123+
{{- if .Values.localsettingspy }}
121124
- name: localsettingspy
122125
readOnly: true
123126
mountPath: /app/dojo/settings/local_settings.py
@@ -127,11 +130,8 @@ spec:
127130
- name: cert-mount
128131
mountPath: {{ .Values.django.uwsgi.certificates.certMountPath }}
129132
{{- end }}
130-
{{- range .Values.celery.extraVolumes }}
131-
- name: userconfig-{{ .name }}
132-
readOnly: true
133-
mountPath: {{ .path }}
134-
subPath: {{ .subPath }}
133+
{{- with .Values.celery.worker.extraVolumeMounts }}
134+
{{- . | toYaml | nindent 8 }}
135135
{{- end }}
136136
envFrom:
137137
- configMapRef:
@@ -157,8 +157,8 @@ spec:
157157
secretKeyRef:
158158
name: {{ $fullName }}
159159
key: DD_SECRET_KEY
160-
{{- with .Values.extraEnv }}
161-
{{- toYaml . | nindent 8 }}
160+
{{- with .Values.celery.worker.extraEnv }}
161+
{{- . | toYaml | nindent 8 }}
162162
{{- end }}
163163
resources:
164164
{{- toYaml .Values.celery.worker.resources | nindent 10 }}

helm/defectdojo/templates/configmap.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ data:
5454
{{- if .Values.django.uwsgi.certificates.enabled }}
5555
REQUESTS_CA_BUNDLE: {{ .Values.django.uwsgi.certificates.certMountPath }}{{ .Values.django.uwsgi.certificates.certFileName }}
5656
{{- end }}
57-
{{- with .Values.extraConfigs }}
58-
{{- toYaml . | nindent 2 }}{{- end }}
57+
{{- with .Values.extraConfigs }}
58+
{{- toYaml . | nindent 2 }}
59+
{{- end }}

helm/defectdojo/templates/django-deployment.yaml

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ spec:
2424
strategy:
2525
{{- toYaml . | nindent 4 }}
2626
{{- end }}
27-
{{- if .Values.revisionHistoryLimit }}
28-
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
27+
{{- with .Values.revisionHistoryLimit }}
28+
revisionHistoryLimit: {{ . }}
2929
{{- end }}
3030
selector:
3131
matchLabels:
@@ -61,9 +61,9 @@ spec:
6161
{{- end }}
6262
spec:
6363
serviceAccountName: {{ include "defectdojo.serviceAccountName" . }}
64-
{{- if .Values.imagePullSecrets }}
64+
{{- with .Values.imagePullSecrets }}
6565
imagePullSecrets:
66-
- name: {{ .Values.imagePullSecrets }}
66+
- name: {{ quote . }}
6767
{{- end }}
6868
{{- if .Values.django.mediaPersistentVolume.enabled }}
6969
securityContext:
@@ -72,41 +72,34 @@ spec:
7272
volumes:
7373
- name: run
7474
emptyDir: {}
75-
{{- if .Values.localsettingspy }}
75+
{{- if .Values.localsettingspy }}
7676
- name: localsettingspy
7777
configMap:
7878
name: {{ $fullName }}-localsettingspy
7979
{{- end }}
80-
{{- if .Values.django.uwsgi.certificates.enabled }}
80+
{{- if .Values.django.uwsgi.certificates.enabled }}
8181
- name: cert-mount
8282
configMap:
8383
name: {{ .Values.django.uwsgi.certificates.configName }}
8484
{{- end }}
85-
{{- range .Values.django.extraVolumes }}
86-
- name: userconfig-{{ .name }}
87-
{{ .type }}:
88-
{{- if (eq .type "configMap") }}
89-
name: {{ .name }}
90-
{{- else if (eq .type "secret") }}
91-
secretName: {{ .name }}
92-
{{- else if (eq .type "hostPath") }}
93-
type: {{ .pathType | default "Directory" }}
94-
path: {{ .hostPath }}
95-
{{- end }}
85+
{{- with .Values.django.extraVolumes }}
86+
{{- . | toYaml | nindent 6 }}
9687
{{- end }}
9788
{{- if .Values.django.mediaPersistentVolume.enabled }}
9889
- name: {{ .Values.django.mediaPersistentVolume.name }}
99-
{{- if eq .Values.django.mediaPersistentVolume.type "pvc" }}
90+
{{- if eq .Values.django.mediaPersistentVolume.type "pvc" }}
10091
persistentVolumeClaim:
10192
claimName: {{ include "django.pvc_name" $ }}
10293
{{ else }}
10394
emptyDir: {}
10495
{{- end }}
10596
{{- end }}
106-
{{- if or .Values.dbMigrationChecker.enabled .Values.cloudsql.enabled }}
97+
{{- if coalesce .Values.dbMigrationChecker.enabled .Values.cloudsql.enabled .Values.django.extraInitContainers }}
10798
initContainers:
99+
{{- range .Values.django.extraInitContainers }}
100+
- {{- . | toYaml | nindent 8 }}
108101
{{- end }}
109-
{{- if .Values.cloudsql.enabled }}
102+
{{- if .Values.cloudsql.enabled }}
110103
- name: cloudsql-proxy
111104
image: {{ .Values.cloudsql.image.repository }}:{{ .Values.cloudsql.image.tag }}
112105
imagePullPolicy: {{ .Values.cloudsql.image.pullPolicy }}
@@ -129,6 +122,7 @@ spec:
129122
{{- $newContext := merge . (dict "fullName" $fullName) }}
130123
{{- include "dbMigrationChecker" $newContext | nindent 6 }}
131124
{{- end }}
125+
{{- end }}
132126
containers:
133127
{{- if and .Values.monitoring.enabled .Values.monitoring.prometheus.enabled }}
134128
- name: metrics
@@ -157,23 +151,18 @@ spec:
157151
volumeMounts:
158152
- name: run
159153
mountPath: /run/defectdojo
160-
{{- if .Values.localsettingspy }}
154+
{{- if .Values.localsettingspy }}
161155
- name: localsettingspy
162156
readOnly: true
163157
mountPath: /app/dojo/settings/local_settings.py
164158
subPath: file
165159
{{- end }}
166-
{{- if .Values.django.uwsgi.certificates.enabled }}
160+
{{- if .Values.django.uwsgi.certificates.enabled }}
167161
- name: cert-mount
168162
mountPath: {{ .Values.django.uwsgi.certificates.certMountPath }}
169163
{{- end }}
170-
{{- range .Values.django.extraVolumes }}
171-
{{- if (eq .container "uwsgi") }}
172-
- name: userconfig-{{ .name }}
173-
readOnly: true
174-
mountPath: {{ .path }}
175-
subPath: {{ .subPath }}
176-
{{- end }}
164+
{{- with .Values.django.uwsgi.extraVolumeMounts }}
165+
{{- . | toYaml | nindent 8 }}
177166
{{- end }}
178167
{{- if .Values.django.mediaPersistentVolume.enabled }}
179168
- name: {{ .Values.django.mediaPersistentVolume.name }}
@@ -220,8 +209,8 @@ spec:
220209
value: {{- if or .Values.django.ingress.activateTLS .Values.django.nginx.tls.enabled }} "True" {{- else }} "False" {{- end }}
221210
- name: DD_CSRF_COOKIE_SECURE
222211
value: {{- if or .Values.django.ingress.activateTLS .Values.django.nginx.tls.enabled }} "True" {{- else }} "False" {{- end }}
223-
{{- with .Values.extraEnv }}
224-
{{- toYaml . | nindent 8 }}
212+
{{- with .Values.django.uwsgi.extraEnv }}
213+
{{- . | toYaml | nindent 8 }}
225214
{{- end }}
226215
{{- if .Values.django.uwsgi.livenessProbe.enabled }}
227216
livenessProbe:
@@ -249,13 +238,8 @@ spec:
249238
volumeMounts:
250239
- name: run
251240
mountPath: /run/defectdojo
252-
{{- range .Values.django.extraVolumes }}
253-
{{- if (eq .container "nginx") }}
254-
- name: userconfig-{{ .name }}
255-
readOnly: true
256-
mountPath: {{ .path }}
257-
subPath: {{ .subPath }}
258-
{{- end }}
241+
{{- with .Values.django.nginx.extraVolumeMounts }}
242+
{{- . | toYaml | nindent 8 }}
259243
{{- end }}
260244
{{- if .Values.django.mediaPersistentVolume.enabled }}
261245
- name: {{ .Values.django.mediaPersistentVolume.name }}
@@ -278,6 +262,9 @@ spec:
278262
value: '{{ .Values.django.nginx.tls.enabled }}'
279263
- name: GENERATE_TLS_CERTIFICATE
280264
value: '{{ .Values.django.nginx.tls.generateCertificate }}'
265+
{{- with .Values.django.nginx.extraEnv }}
266+
{{- . | toYaml | nindent 8 }}
267+
{{- end }}
281268
{{- if .Values.django.uwsgi.livenessProbe.enabled }}
282269
livenessProbe:
283270
httpGet:

helm/defectdojo/templates/initializer-job.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ spec:
9595
- configMapRef:
9696
name: {{ $fullName }}
9797
- secretRef:
98-
name: {{ $fullName }}
98+
name: {{ $fullName }}-extrasecrets
9999
optional: true
100100
env:
101-
{{- with .Values.extraEnv }}
101+
{{- with .Values.initializer.extraEnv }}
102102
{{- toYaml . | nindent 8 }}
103103
{{- end }}
104104
resources:
@@ -130,14 +130,15 @@ spec:
130130
- configMapRef:
131131
name: {{ $fullName }}
132132
- secretRef:
133-
name: {{ $fullName }}
133+
name: {{ $fullName }}-extrasecrets
134+
optional: true
134135
env:
135136
- name: DD_DATABASE_PASSWORD
136137
valueFrom:
137138
secretKeyRef:
138139
name: {{ .Values.postgresql.auth.existingSecret }}
139140
key: {{ .Values.postgresql.auth.secretKeys.userPasswordKey }}
140-
{{- with .Values.extraEnv }}
141+
{{- with .Values.initializer.extraEnv }}
141142
{{- toYaml . | nindent 8 }}
142143
{{- end }}
143144
resources:

0 commit comments

Comments
 (0)