diff --git a/charts/cron-job/templates/cronJob.yaml b/charts/cron-job/templates/cronJob.yaml index 2045e6a..997c52f 100644 --- a/charts/cron-job/templates/cronJob.yaml +++ b/charts/cron-job/templates/cronJob.yaml @@ -13,6 +13,11 @@ spec: jobTemplate: spec: template: + metadata: + annotations: + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 12 }} + {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/charts/cron-job/tests/cronjob_pod_annotations_test.yaml b/charts/cron-job/tests/cronjob_pod_annotations_test.yaml new file mode 100644 index 0000000..c847540 --- /dev/null +++ b/charts/cron-job/tests/cronjob_pod_annotations_test.yaml @@ -0,0 +1,17 @@ +suite: test cron job +templates: + - cronJob.yaml +tests: + - it: Should set pod annotations + set: + podAnnotations: + annotation-one: no-such-annotation + annotation-two: no-such-annotation + asserts: + - template: cronJob.yaml + documentIndex: 0 + equal: + path: spec.jobTemplate.spec.template.metadata.annotations + value: + annotation-one: no-such-annotation + annotation-two: no-such-annotation