Skip to content

Commit

Permalink
feat(testkube-api): ability to specify annotations on job templates (#…
Browse files Browse the repository at this point in the history
…873) (#874)

Similar to `jobPodAnnotations` the introduced `jobAnnotations` enables defining annotations which are applied to the default job templates on installation of testkube-api via Helm.

One use case is to add annotations to prevent ArgoCD from automatically pruning (deleting) these jobs as soon as they are spawned, which otherwise prevents tests from executing successfully.

Fixes #695

Co-authored-by: frederikb <[email protected]>
  • Loading branch information
ed382 and frederikb authored Jun 5, 2024
1 parent 2b8445d commit 02229b6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ kind: Job
metadata:
name: "{{`{{ .Name }}`}}"
namespace: {{`{{ .Namespace }}`}}
{{- with .Values.jobAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{`{{- if gt .ActiveDeadlineSeconds 0 }}`}}
activeDeadlineSeconds: {{`{{ .ActiveDeadlineSeconds }}`}}
Expand Down
4 changes: 4 additions & 0 deletions charts/testkube-api/templates/_job-scraper-template.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ kind: Job
metadata:
name: {{`{{ .Name }}`}}-scraper
namespace: {{`{{ .Namespace }}`}}
{{- with .Values.jobAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{`{{- if gt .ActiveDeadlineSeconds 0 }}`}}
activeDeadlineSeconds: {{`{{ .ActiveDeadlineSeconds }}`}}
Expand Down
4 changes: 4 additions & 0 deletions charts/testkube-api/templates/_job-template.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ kind: Job
metadata:
name: "{{`{{ .Name }}`}}"
namespace: {{`{{ .Namespace }}`}}
{{- with .Values.jobAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{`{{- if gt .ActiveDeadlineSeconds 0 }}`}}
activeDeadlineSeconds: {{`{{ .ActiveDeadlineSeconds }}`}}
Expand Down
4 changes: 4 additions & 0 deletions charts/testkube-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ fullnameOverride: ""
# set annotations for all workflows.
jobPodAnnotations: {}

# jobAnnotations adds annotations to the jobs spawned to execute tests using
# prebuilt and container executors, when using the default job templates.
jobAnnotations: {}

## Custom job-container-template.yml that will be passed to Testkube API
jobContainerTemplate: ""

Expand Down
4 changes: 4 additions & 0 deletions charts/testkube/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ testkube-api:
# set annotations for all workflows.
jobPodAnnotations: {}

# jobAnnotations adds annotations to the jobs spawned to execute tests using
# prebuilt and container executors, when using the default job templates.
jobAnnotations: {}

# Custom job-container-template.yml that will be passed to Testkube API
# jobContainerTemplate: ""
#
Expand Down

0 comments on commit 02229b6

Please sign in to comment.