Skip to content

Commit 5e9f1ae

Browse files
authored
fix(helm): merge extraAnnotations with init job annotations (#13677)
* fix(helm): merge extraAnnotations with init job annotations * fix: artifacthub annotation * docs: 2.53 upgrade instructions * docs(helm): update readme * fix: values schema
1 parent 348a345 commit 5e9f1ae

6 files changed

Lines changed: 57 additions & 12 deletions

File tree

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

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,50 @@
22
title: 'Upgrading to DefectDojo Version 2.53.x'
33
toc_hide: true
44
weight: -20251103
5-
description: No special instructions.
5+
description: Helm chart changes for initializer annotations.
66
---
7-
There are no special instructions for upgrading to 2.53.x. Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.53.0) for the contents of the release.
7+
8+
## Helm Chart Changes
9+
10+
This release introduces an important change to the Helm chart configuration for the initializer job.
11+
12+
### Breaking changes
13+
14+
#### Initializer Annotation Handling
15+
16+
- **Renamed initializer annotations**: The `initializer.annotations` field has been renamed to `initializer.podAnnotations` for clarity and consistency with other DefectDojo resources.
17+
- **Merged annotation support**: Global `extraAnnotations` are now automatically merged with the initializer's `podAnnotations` to ensure consistent annotation handling across all resources.
18+
19+
> The previous implementation did not merge global `extraAnnotations` with the initializer job's pod annotations, causing inconsistencies in annotation management.
20+
21+
#### Moved values
22+
23+
The following Helm chart values have been modified in this release:
24+
25+
- `initializer.annotations``initializer.podAnnotations` (applies to Pod template metadata within the Job)
26+
27+
Note: `initializer.jobAnnotations` affects the Job spec metadata, while `initializer.podAnnotations` affects the Pod template metadata within the Job.
28+
29+
#### Migration
30+
31+
If you were using:
32+
33+
```yaml
34+
initializer:
35+
annotations:
36+
foo: bar
37+
```
38+
39+
Update to:
40+
41+
```yaml
42+
initializer:
43+
podAnnotations:
44+
foo: bar
45+
```
46+
47+
Both `extraAnnotations` and `initializer.podAnnotations` will now be properly applied to the initializer pod.
848

949
## Reimport updates fields fix_available and fix_version
50+
1051
Reimport will update existing findings `fix_available` and `fix_version` fields based on the incoming scan report.

helm/defectdojo/Chart.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: "2.53.0-dev"
33
description: A Helm chart for Kubernetes to install DefectDojo
44
name: defectdojo
5-
version: 1.8.2-dev
5+
version: 1.9.0-dev
66
icon: https://defectdojo.com/hubfs/DefectDojo_favicon.png
77
maintainers:
88
- name: madchap
@@ -34,4 +34,6 @@ dependencies:
3434
# description: Critical bug
3535
annotations:
3636
artifacthub.io/prerelease: "true"
37-
artifacthub.io/changes: ""
37+
artifacthub.io/changes: |
38+
- kind: fixed
39+
description: extraAnnotations spec doesn't affect initializer job

helm/defectdojo/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ kubectl delete pvc data-defectdojo-redis-0 data-defectdojo-postgresql-0
495495
496496
# General information about chart values
497497
498-
![Version: 1.8.2-dev](https://img.shields.io/badge/Version-1.8.2--dev-informational?style=flat-square) ![AppVersion: 2.53.0-dev](https://img.shields.io/badge/AppVersion-2.53.0--dev-informational?style=flat-square)
498+
![Version: 1.9.0-dev](https://img.shields.io/badge/Version-1.9.0--dev-informational?style=flat-square) ![AppVersion: 2.53.0-dev](https://img.shields.io/badge/AppVersion-2.53.0--dev-informational?style=flat-square)
499499
500500
A Helm chart for Kubernetes to install DefectDojo
501501
@@ -683,7 +683,6 @@ A Helm chart for Kubernetes to install DefectDojo
683683
| images.nginx.image.repository | string | `"defectdojo/defectdojo-nginx"` | |
684684
| images.nginx.image.tag | string | `""` | If empty, use appVersion. Another possible values are: latest, X.X.X, X.X.X-alpine (where X.X.X is version of DD). For dev builds (only for testing purposes): nightly-dev, nightly-dev-alpine. To see all, check https://hub.docker.com/r/defectdojo/defectdojo-nginx/tags. |
685685
| initializer.affinity | object | `{}` | |
686-
| initializer.annotations | object | `{}` | |
687686
| initializer.automountServiceAccountToken | bool | `false` | |
688687
| initializer.containerSecurityContext | object | `{}` | Container security context for the initializer Job container |
689688
| initializer.extraEnv | list | `[]` | Additional environment variables injected to the initializer job pods. |
@@ -694,6 +693,7 @@ A Helm chart for Kubernetes to install DefectDojo
694693
| initializer.keepSeconds | int | `60` | A positive integer will keep this Job and Pod deployed for the specified number of seconds, after which they will be removed. For all other values, the Job and Pod will remain deployed. |
695694
| initializer.labels | object | `{}` | |
696695
| initializer.nodeSelector | object | `{}` | |
696+
| initializer.podAnnotations | object | `{}` | |
697697
| initializer.podSecurityContext | object | `{}` | Pod security context for the initializer Job |
698698
| initializer.resources.limits.cpu | string | `"2000m"` | |
699699
| initializer.resources.limits.memory | string | `"512Mi"` | |

helm/defectdojo/templates/initializer-job.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ spec:
3636
{{- with .Values.initializer.labels }}
3737
{{- toYaml . | nindent 8 }}
3838
{{- end }}
39+
{{- with mergeOverwrite dict .Values.extraAnnotations .Values.initializer.podAnnotations }}
3940
annotations:
40-
{{- with .Values.initializer.annotations }}
41-
{{- toYaml . | nindent 8 }}
41+
{{- range $key, $value := . }}
42+
{{ $key }}: {{ quote $value }}
43+
{{- end }}
4244
{{- end }}
4345
spec:
4446
{{- if .Values.securityContext.enabled }}

helm/defectdojo/values.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,6 @@
914914
"affinity": {
915915
"type": "object"
916916
},
917-
"annotations": {
918-
"type": "object"
919-
},
920917
"automountServiceAccountToken": {
921918
"type": "boolean"
922919
},
@@ -967,6 +964,9 @@
967964
"nodeSelector": {
968965
"type": "object"
969966
},
967+
"podAnnotations": {
968+
"type": "object"
969+
},
970970
"podSecurityContext": {
971971
"description": "Pod security context for the initializer Job",
972972
"type": "object"

helm/defectdojo/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ initializer:
486486
run: true
487487
automountServiceAccountToken: false
488488
jobAnnotations: {}
489-
annotations: {}
489+
podAnnotations: {}
490490
labels: {}
491491
# -- A positive integer will keep this Job and Pod deployed for the specified number of seconds, after which they will be removed. For all other values, the Job and Pod will remain deployed.
492492
keepSeconds: 60

0 commit comments

Comments
 (0)