Skip to content

Commit ee3bede

Browse files
committed
feat(HELM): Use Postgres from CloudPirates
Signed-off-by: kiblik <[email protected]>
1 parent a2451fe commit ee3bede

File tree

18 files changed

+208
-228
lines changed

18 files changed

+208
-228
lines changed

.github/workflows/k8s-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
--set valkey.enabled=true \
7777
--set createValkeySecret=true \
7878
--set postgresql.enabled=true \
79-
--set createPostgresqlSecret=true \
79+
--set createPostgresSecret=true \
8080
--set createSecret=true
8181
8282
- name: Check deployment status

.github/workflows/test-helm-chart.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
# if: steps.list_changed.outputs.changed == 'true'
9999

100100
# - name: Run chart-testing (install)
101-
# run: ct install --config ct.yaml --target-branch ${{ env.ct-branch }} --helm-extra-args '--set createSecret=true --set createRabbitMqSecret=true --set createPostgresqlSecret=true --set timeout=900'
101+
# run: ct install --config ct.yaml --target-branch ${{ env.ct-branch }} --helm-extra-args '--set createSecret=true --set createRabbitMqSecret=true --set createPostgresSecret=true --set timeout=900'
102102
# if: steps.list_changed.outputs.changed == 'true'
103103

104104
docs_generation:

docs/content/en/open_source/upgrading/2.54.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'Upgrading to DefectDojo Version 2.54.x'
33
toc_hide: true
44
weight: -20251201
5-
description: Removal of django-auditlog and exclusive use of django-pghistory for audit logging & Dropped support for DD_PARSER_EXCLUDE
5+
description: "Removal of django-auditlog and exclusive use of django-pghistory for audit logging & Helm chart: Postgresql from Bitnami was replaces with CloudPirates & Dropped support for DD_PARSER_EXCLUDE"
66
---
77

88
## Breaking Change: Removal of django-auditlog
@@ -39,6 +39,46 @@ The switch to `django-pghistory` provides several advantages:
3939

4040
The backfill migration is not mandatory to succeed. If it fails for some reason, the only side effect will be that the first auditlog diff will contain all fields of an object instead just the changed fields.
4141

42+
## Breaking Change: Helm chart - Postgresql from Bitnami was replaces with CloudPirates
43+
44+
##### Renamed + removed values
45+
46+
HELM values had been changed to the following:
47+
- `createPostgresqlSecret``createPostgresSecret`
48+
- `postgresql.enabled``postgres.enabled`
49+
- `postgresql.auth.username``postgres.auth.username`
50+
- `postgresql.auth.password``postgres.auth.password`
51+
- `postgresql.auth.database``postgres.auth.database`
52+
- `postgresql.auth.existingSecret``postgres.auth.existingSecret`, plus value is pointing to secret `defectdojo-postgres-specific` now
53+
- `postgresql.auth.secretKeys.adminPasswordKey``postgres.auth.secretKeys.adminPasswordKey`, plus value is pointing to secret `postgres-password` now
54+
- `postgresql.auth.secretKeys.userPasswordKey` - is not used anymore
55+
- `postgresql.auth.secretKeys.replicationPasswordKey` - is not used anymore
56+
- `postgresql.architecture` - is not used anymore
57+
- `postgresql.primary.service.ports.postgresql``postgres.service.port`
58+
- rest of `postgresql.primary...` is not used anymore
59+
60+
TODO - finish this
61+
62+
The whole subchart is based on [`cloudpirates-postgres`](https://artifacthub.io/packages/helm/cloudpirates-postgres/postgres), so all additional values can be found there.
63+
64+
If an external Postgres instance is being used, set the parameter `postgres.enabled` to `False`. The parameter `postgresServer` remains available and function as before.
65+
66+
##### How to migrate to Valkey
67+
68+
0. As always, perform a backup of your instance
69+
1. If you would like to be 100% sure that you do not miss any async event (triggered deduplication, email notification, ...) it is recommended to perform the following substeps (if your system is not in production and/or you are willing to miss some notifications or postpone deduplication to a later time, feel free to skip these substeps)
70+
0. Perform the following steps with your previous version of HELM chart (not with the upgraded one - you might lose your data)
71+
1. Downscale all producers of async tasks:
72+
- Set `django.replicas` to 0 (if you used HPA, adjust it based on your needs)
73+
- Set `celery.beat.replicas` to 0 (if you used HPA, adjust it based on your needs)
74+
- Do not change `celery.worker.replicas` (they are responsible for processing your async tasks)
75+
2. Wait until the processing queue is empty (choose one of the following methods):
76+
- ``kubectl exec statefulset/defectdojo-redis-master -c redis -- redis-cli -a `kubectl get secret defectdojo-redis-specific -o go-template='{{index .data "redis-password" | base64decode}}'` llen celery`` -- should output 0 (if your HELM chart used a different name, adjust the command based on your environment)
77+
- `kubectl logs deployment/defectdojo-celery-worker -c celery --all-pods=true --follow` -- should stop outputting new task logs
78+
2. Replace values based on the _Renamed values_ part, update the chart version, and set the number of replicas back. Be aware that Valkey is using a password from the new location, and if you use `createRedisSecret`/`createValkeySecret` password will be regenerated. If you stored this password somewhere else, it will not be valid anymore.
79+
3. Enjoy DefectDojo
80+
81+
4282
## Dropped support for DD_PARSER_EXCLUDE
4383

4484
To simplify the management of the DefectDojo application, parser exclusions are no longer controlled via the environment variable DD_PARSER_EXCLUDE or application settings. This variable is now unsupported.

helm/defectdojo/Chart.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
dependencies:
2-
- name: postgresql
3-
repository: oci://us-docker.pkg.dev/os-public-container-registry/defectdojo
4-
version: 16.7.27
2+
- name: postgres
3+
repository: oci://registry-1.docker.io/cloudpirates
4+
version: 0.13.3
55
- name: valkey
66
repository: oci://registry-1.docker.io/cloudpirates
7-
version: 0.10.2
8-
digest: sha256:65773fc2a992a5688995a98ed396ca54de12b88fd7b124459a39961801ae62f3
9-
generated: "2025-11-25T20:48:39.324383+01:00"
7+
version: 0.10.3
8+
digest: sha256:7a3415b78a329b5d7ffaa860d774d9a6050cf3ad25bb217f37e32de30c0e2cce
9+
generated: "2025-12-11T22:37:23.132676+01:00"

helm/defectdojo/Chart.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ maintainers:
99
1010
url: https://github.com/DefectDojo/django-DefectDojo
1111
dependencies:
12-
- name: postgresql
13-
version: ~16.7.0
14-
repository: "oci://us-docker.pkg.dev/os-public-container-registry/defectdojo"
15-
condition: postgresql.enabled
12+
- name: postgres
13+
version: 0.13.3
14+
repository: "oci://registry-1.docker.io/cloudpirates"
15+
condition: postgres.enabled
1616
- name: valkey
1717
version: ~0.10.0
1818
repository: "oci://registry-1.docker.io/cloudpirates"
@@ -37,3 +37,5 @@ annotations:
3737
artifacthub.io/changes: |
3838
- kind: changed
3939
description: chore(deps)_ update gcr.io/cloudsql_docker/gce_proxy docker tag from 1.37.10 to v1.37.11 (helm/defectdojo/values.yaml)
40+
- kind: changed
41+
description: PostgreSQL from Bitnami replaced with CloudPirates

helm/defectdojo/README.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ helm install \
9595
--set django.ingress.activateTLS=${DJANGO_INGRESS_ACTIVATE_TLS} \
9696
--set createSecret=true \
9797
--set createValkeySecret=true \
98-
--set createPostgresqlSecret=true
98+
--set createPostgresSecret=true
9999
```
100100

101101
It usually takes up to a minute for the services to startup and the
@@ -281,7 +281,7 @@ helm install \
281281
--set django.ingress.secretName="minikube-tls" \
282282
--set createSecret=true \
283283
--set createValkeySecret=true \
284-
--set createPostgresqlSecret=true
284+
--set createPostgresSecret=true
285285

286286
# For high availability deploy multiple instances of Django, Celery and Valkey
287287
helm install \
@@ -296,7 +296,7 @@ helm install \
296296
--set valkey.replicaCount=3 \
297297
--set createSecret=true \
298298
--set createValkeySecret=true \
299-
--set createPostgresqlSecret=true
299+
--set createPostgresSecret=true
300300

301301
# Run highly available PostgreSQL cluster
302302
# for production environment.
@@ -310,12 +310,12 @@ helm install \
310310
--set valkey.architecture=replication \
311311
--set valkey.replicaCount=3 \
312312
--set django.ingress.secretName="minikube-tls" \
313-
--set postgresql.enabled=true \
314-
--set postgresql.replication.enabled=true \
315-
--set postgresql.replication.slaveReplicas=3 \
313+
--set postgres.enabled=true \
314+
--set postgres.replication.enabled=true \
315+
--set postgres.replication.slaveReplicas=3 \
316316
--set createSecret=true \
317317
--set createValkeySecret=true \
318-
--set createPostgresqlSecret=true
318+
--set createPostgresSecret=true
319319

320320
# Note: If you run `helm install defectdojo before, you will get an error
321321
# message like `Error: release defectdojo failed: secrets "defectdojo" already
@@ -393,7 +393,7 @@ Sample secret template (replace the placeholders with your PostgreSQL credential
393393
apiversion: v1
394394
kind: Secret
395395
metadata:
396-
name: defectdojo-postgresql-specific
396+
name: defectdojo-postgres-specific
397397
type: Opaque
398398
stringData: # I chose stringData for better visualization of the credentials for debugging
399399
password: <user-password>
@@ -435,9 +435,7 @@ postgresql:
435435
database: defectdojo # your database name
436436
secretKeys:
437437
adminPasswordKey: password # the name of the field containing the password value
438-
userPasswordKey: password # the name of the field containing the password value
439-
replicationPasswordKey: password # the name of the field containing the password value
440-
existingSecret: defectdojo-postgresql-specific # the secret containing your database password
438+
existingSecret: defectdojo-postgres-specific # the secret containing your database password
441439
442440
extraEnv:
443441
# Overwrite the database endpoint
@@ -487,7 +485,7 @@ helm uninstall defectdojo
487485
To remove persistent objects not removed by uninstall (this will remove any database):
488486
489487
```
490-
kubectl delete secrets defectdojo defectdojo-redis-specific defectdojo-postgresql-specific
488+
kubectl delete secrets defectdojo defectdojo-redis-specific defectdojo-postgres-specific
491489
kubectl delete serviceAccount defectdojo
492490
kubectl delete pvc data-defectdojo-redis-0 data-defectdojo-postgresql-0
493491
```
@@ -525,8 +523,8 @@ A Helm chart for Kubernetes to install DefectDojo
525523
526524
| Repository | Name | Version |
527525
|------------|------|---------|
526+
| oci://registry-1.docker.io/cloudpirates | postgres | 0.13.3 |
528527
| oci://registry-1.docker.io/cloudpirates | valkey | ~0.10.0 |
529-
| oci://us-docker.pkg.dev/os-public-container-registry/defectdojo | postgresql | ~16.7.0 |
530528
531529
## Values
532530
@@ -600,7 +598,7 @@ A Helm chart for Kubernetes to install DefectDojo
600598
| cloudsql.resources | object | `{}` | Optional: add resource requests/limits for the CloudSQL proxy container. |
601599
| cloudsql.use_private_ip | bool | `false` | whether to use a private IP to connect to the database |
602600
| cloudsql.verbose | bool | `true` | By default, the proxy has verbose logging. Set this to false to make it less verbose |
603-
| createPostgresqlSecret | bool | `false` | create postgresql secret in defectdojo chart, outside of postgresql chart |
601+
| createPostgresSecret | bool | `false` | create postgresql secret in defectdojo chart, outside of postgresql chart |
604602
| createSecret | bool | `false` | create defectdojo specific secret |
605603
| createValkeySecret | bool | `false` | create valkey secret in defectdojo chart, outside of valkey chart |
606604
| dbMigrationChecker.containerSecurityContext | object | `{}` | Container security context for the DB migration checker. |
@@ -740,14 +738,12 @@ A Helm chart for Kubernetes to install DefectDojo
740738
| networkPolicy.ingress | list | `[]` | For more detailed configuration with ports and peers. It will ignore ingressExtend ``` ingress: - from: - podSelector: matchLabels: app.kubernetes.io/instance: defectdojo - podSelector: matchLabels: app.kubernetes.io/instance: defectdojo-prometheus ports: - protocol: TCP port: 8443 ``` |
741739
| networkPolicy.ingressExtend | list | `[]` | if additional labels need to be allowed (e.g. prometheus scraper) ``` ingressExtend: - podSelector: matchLabels: app.kubernetes.io/instance: defectdojo-prometheus ``` |
742740
| podLabels | object | `{}` | Additional labels to add to the pods: ``` podLabels: key: value ``` |
743-
| postgresServer | string | `nil` | To use an external PostgreSQL instance (like CloudSQL), set `postgresql.enabled` to false, set items in `postgresql.auth` part for authentication, and set the address here: |
744-
| postgresql | object | `{"architecture":"standalone","auth":{"database":"defectdojo","existingSecret":"defectdojo-postgresql-specific","password":"","secretKeys":{"adminPasswordKey":"postgresql-postgres-password","replicationPasswordKey":"postgresql-replication-password","userPasswordKey":"postgresql-password"},"username":"defectdojo"},"enabled":true,"primary":{"affinity":{},"containerSecurityContext":{"enabled":true,"runAsUser":1001},"name":"primary","nodeSelector":{},"persistence":{"enabled":true},"podSecurityContext":{"enabled":true,"fsGroup":1001},"service":{"ports":{"postgresql":5432}}},"shmVolume":{"chmod":{"enabled":false}},"volumePermissions":{"containerSecurityContext":{"runAsUser":1001},"enabled":false}}` | For more advance options check the bitnami chart documentation: https://github.com/bitnami/charts/tree/main/bitnami/postgresql |
745-
| postgresql.enabled | bool | `true` | To use an external instance, switch enabled to `false` and set the address in `postgresServer` below |
746-
| postgresql.primary.containerSecurityContext.enabled | bool | `true` | Default is true for K8s. Enabled needs to false for OpenShift restricted SCC and true for anyuid SCC |
747-
| postgresql.primary.containerSecurityContext.runAsUser | int | `1001` | runAsUser specification below is not applied if enabled=false. enabled=false is the required setting for OpenShift "restricted SCC" to work successfully. |
748-
| postgresql.primary.podSecurityContext.enabled | bool | `true` | Default is true for K8s. Enabled needs to false for OpenShift restricted SCC and true for anyuid SCC |
749-
| postgresql.primary.podSecurityContext.fsGroup | int | `1001` | fsGroup specification below is not applied if enabled=false. enabled=false is the required setting for OpenShift "restricted SCC" to work successfully. |
750-
| postgresql.volumePermissions.containerSecurityContext | object | `{"runAsUser":1001}` | if using restricted SCC set runAsUser: "auto" and if running under anyuid SCC - runAsUser needs to match the line above |
741+
| postgres | object | `{"affinity":{},"auth":{"database":"defectdojo","existingSecret":"defectdojo-postgres-specific","password":"","secretKeys":{"adminPasswordKey":"postgres-password"},"username":"defectdojo"},"containerSecurityContext":{"runAsUser":1001},"enabled":true,"nodeSelector":{},"persistence":{"containerSecurityContext":{"runAsUser":1001},"enabled":false},"podSecurityContext":{"fsGroup":1001},"service":{"port":5432},"shmVolume":{"chmod":{"enabled":false}}}` | For more advance options check the bitnami chart documentation: https://artifacthub.io/packages/helm/cloudpirates-postgres/postgres |
742+
| postgres.containerSecurityContext.runAsUser | int | `1001` | runAsUser specification below is not applied if enabled=false. enabled=false is the required setting for OpenShift "restricted SCC" to work successfully. |
743+
| postgres.enabled | bool | `true` | To use an external instance, switch enabled to `false` and set the address in `postgresServer` below |
744+
| postgres.persistence.containerSecurityContext | object | `{"runAsUser":1001}` | if using restricted SCC set runAsUser: "auto" and if running under anyuid SCC - runAsUser needs to match the line above |
745+
| postgres.podSecurityContext.fsGroup | int | `1001` | fsGroup specification below is not applied if enabled=false. enabled=false is the required setting for OpenShift "restricted SCC" to work successfully. |
746+
| postgresServer | string | `nil` | To use an external PostgreSQL instance (like CloudSQL), set `postgres.enabled` to false, set items in `postgres.auth` part for authentication, and set the address here: |
751747
| redisParams | string | `""` | Parameters attached to the redis connection string, defaults to "ssl_cert_reqs=optional" if `redisScheme` is `rediss` |
752748
| redisPort | int | `6379` | Define the protocol to use with the external Redis instance |
753749
| redisScheme | string | `"redis"` | Define the protocol to use with the external Redis instance |

helm/defectdojo/README.md.gotmpl

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ helm install \
9595
--set django.ingress.activateTLS=${DJANGO_INGRESS_ACTIVATE_TLS} \
9696
--set createSecret=true \
9797
--set createValkeySecret=true \
98-
--set createPostgresqlSecret=true
98+
--set createPostgresSecret=true
9999
```
100100

101101
It usually takes up to a minute for the services to startup and the
@@ -281,7 +281,7 @@ helm install \
281281
--set django.ingress.secretName="minikube-tls" \
282282
--set createSecret=true \
283283
--set createValkeySecret=true \
284-
--set createPostgresqlSecret=true
284+
--set createPostgresSecret=true
285285

286286
# For high availability deploy multiple instances of Django, Celery and Valkey
287287
helm install \
@@ -296,7 +296,7 @@ helm install \
296296
--set valkey.replicaCount=3 \
297297
--set createSecret=true \
298298
--set createValkeySecret=true \
299-
--set createPostgresqlSecret=true
299+
--set createPostgresSecret=true
300300

301301
# Run highly available PostgreSQL cluster
302302
# for production environment.
@@ -310,12 +310,12 @@ helm install \
310310
--set valkey.architecture=replication \
311311
--set valkey.replicaCount=3 \
312312
--set django.ingress.secretName="minikube-tls" \
313-
--set postgresql.enabled=true \
314-
--set postgresql.replication.enabled=true \
315-
--set postgresql.replication.slaveReplicas=3 \
313+
--set postgres.enabled=true \
314+
--set postgres.replication.enabled=true \
315+
--set postgres.replication.slaveReplicas=3 \
316316
--set createSecret=true \
317317
--set createValkeySecret=true \
318-
--set createPostgresqlSecret=true
318+
--set createPostgresSecret=true
319319

320320
# Note: If you run `helm install defectdojo before, you will get an error
321321
# message like `Error: release defectdojo failed: secrets "defectdojo" already
@@ -393,7 +393,7 @@ Sample secret template (replace the placeholders with your PostgreSQL credential
393393
apiversion: v1
394394
kind: Secret
395395
metadata:
396-
name: defectdojo-postgresql-specific
396+
name: defectdojo-postgres-specific
397397
type: Opaque
398398
stringData: # I chose stringData for better visualization of the credentials for debugging
399399
password: <user-password>
@@ -435,9 +435,7 @@ postgresql:
435435
database: defectdojo # your database name
436436
secretKeys:
437437
adminPasswordKey: password # the name of the field containing the password value
438-
userPasswordKey: password # the name of the field containing the password value
439-
replicationPasswordKey: password # the name of the field containing the password value
440-
existingSecret: defectdojo-postgresql-specific # the secret containing your database password
438+
existingSecret: defectdojo-postgres-specific # the secret containing your database password
441439

442440
extraEnv:
443441
# Overwrite the database endpoint
@@ -489,7 +487,7 @@ helm uninstall defectdojo
489487
To remove persistent objects not removed by uninstall (this will remove any database):
490488

491489
```
492-
kubectl delete secrets defectdojo defectdojo-redis-specific defectdojo-postgresql-specific
490+
kubectl delete secrets defectdojo defectdojo-redis-specific defectdojo-postgres-specific
493491
kubectl delete serviceAccount defectdojo
494492
kubectl delete pvc data-defectdojo-redis-0 data-defectdojo-postgresql-0
495493
```

0 commit comments

Comments
 (0)