From 59a48eeb3356f7662087151bc17f984df10fdee9 Mon Sep 17 00:00:00 2001 From: Florian Heubeck Date: Thu, 5 Dec 2024 15:28:41 +0100 Subject: [PATCH] [HTTP-Metronome] Option to add podTemplate annotations --- .../ci/test-podTemplate-annotation-values.yaml | 9 +++++++++ charts/http-metronome/Chart.yaml | 2 +- charts/http-metronome/templates/CronJobs.yaml | 9 +++++++-- charts/http-metronome/values.yaml | 4 ++++ 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 chart-tests/http-metronome/ci/test-podTemplate-annotation-values.yaml diff --git a/chart-tests/http-metronome/ci/test-podTemplate-annotation-values.yaml b/chart-tests/http-metronome/ci/test-podTemplate-annotation-values.yaml new file mode 100644 index 0000000..55d81c1 --- /dev/null +++ b/chart-tests/http-metronome/ci/test-podTemplate-annotation-values.yaml @@ -0,0 +1,9 @@ +podTemplate: + annotations: + linkerd.io/inject: disabled + +jobs: + - name: this-is-just-a-test # MANDATORY: name of the cron-job that should be created + schedule: "* * * * *" # MANDATORY: cron expression this job trigger should run + target: http://the-cluster-local-service/the-path # MANDATORY: http endpoint within the cluster that should be called using GET + activeDeadlineSeconds: 60 # MANDATORY: maximum lifetime of a single job execution diff --git a/charts/http-metronome/Chart.yaml b/charts/http-metronome/Chart.yaml index f56a3c9..ec76eac 100644 --- a/charts/http-metronome/Chart.yaml +++ b/charts/http-metronome/Chart.yaml @@ -7,4 +7,4 @@ maintainers: - name: MediaMarktSaturn url: https://github.com/MediaMarktSaturn appVersion: 1.0.0 -version: 1.0.0 +version: 1.1.0 diff --git a/charts/http-metronome/templates/CronJobs.yaml b/charts/http-metronome/templates/CronJobs.yaml index d5e1bd7..9806571 100644 --- a/charts/http-metronome/templates/CronJobs.yaml +++ b/charts/http-metronome/templates/CronJobs.yaml @@ -22,11 +22,16 @@ spec: ttlSecondsAfterFinished: {{ $.Values.ttlSecondsAfterFinished }} activeDeadlineSeconds: {{ .activeDeadlineSeconds }} template: - {{- if $.Values.istioManaged }} metadata: + {{- if $.Values.istioManaged }} labels: istio-prometheus-ignore: "true" - {{- end }} + {{- end }} + annotations: {{ if not $.Values.podTemplate.annotations }}{}{{ else }} + {{- range $k, $v := $.Values.podTemplate.annotations }} + {{ $k }}: {{ $v | quote }} + {{- end }} + {{- end }} spec: automountServiceAccountToken: false containers: diff --git a/charts/http-metronome/values.yaml b/charts/http-metronome/values.yaml index 7baa41a..841a58a 100644 --- a/charts/http-metronome/values.yaml +++ b/charts/http-metronome/values.yaml @@ -22,6 +22,10 @@ startingDeadlineSeconds: 200 # in an istio meshed environment, sidecar lifecycle has to be managed istioManaged: false +# annotations to be added to the job template +podTemplate: + annotations: {} + # list of cronjobs that should run, structure see below. jobs: - name: this-is-just-a-test # MANDATORY: name of the cron-job that should be created