From 004962397179dbade61cec45e70243bbeaedb493 Mon Sep 17 00:00:00 2001 From: Lukas Novotny Date: Tue, 28 Jun 2022 14:15:22 +0200 Subject: [PATCH] Add pod annotations to jobs. --- .../datahub-upgrade/datahub-cleanup-job-template.yml | 10 ++++++++-- .../datahub-restore-indices-job-template.yml | 10 ++++++++-- .../templates/datahub-upgrade/datahub-upgrade-job.yml | 10 ++++++++-- charts/datahub/templates/elasticsearch-setup-job.yml | 10 ++++++++-- charts/datahub/templates/kafka-setup-job.yml | 10 ++++++++-- charts/datahub/templates/mysql-setup-job.yml | 10 ++++++++-- charts/datahub/templates/postgresql-setup-job.yml | 10 ++++++++-- 7 files changed, 56 insertions(+), 14 deletions(-) diff --git a/charts/datahub/templates/datahub-upgrade/datahub-cleanup-job-template.yml b/charts/datahub/templates/datahub-upgrade/datahub-cleanup-job-template.yml index ca306fb5c..532e8c147 100644 --- a/charts/datahub/templates/datahub-upgrade/datahub-cleanup-job-template.yml +++ b/charts/datahub/templates/datahub-upgrade/datahub-cleanup-job-template.yml @@ -18,13 +18,19 @@ spec: jobTemplate: spec: template: - {{- if .Values.global.podLabels }} + {{- if or .Values.global.podLabels .Values.datahubUpgrade.podAnnotations }} metadata: + {{- with .Values.datahubUpgrade.podAnnotations }} + annotations: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.global.podLabels }} labels: - {{- range $key, $value := .Values.global.podLabels }} + {{- range $key, $value := . }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} + {{- end }} spec: {{- with .Values.global.hostAliases }} hostAliases: diff --git a/charts/datahub/templates/datahub-upgrade/datahub-restore-indices-job-template.yml b/charts/datahub/templates/datahub-upgrade/datahub-restore-indices-job-template.yml index cf9a7150e..d47dcab7a 100644 --- a/charts/datahub/templates/datahub-upgrade/datahub-restore-indices-job-template.yml +++ b/charts/datahub/templates/datahub-upgrade/datahub-restore-indices-job-template.yml @@ -18,13 +18,19 @@ spec: jobTemplate: spec: template: - {{- if .Values.global.podLabels }} + {{- if or .Values.global.podLabels .Values.datahubUpgrade.podAnnotations }} metadata: + {{- with .Values.datahubUpgrade.podAnnotations }} + annotations: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.global.podLabels }} labels: - {{- range $key, $value := .Values.global.podLabels }} + {{- range $key, $value := . }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} + {{- end }} spec: {{- with .Values.global.hostAliases }} hostAliases: diff --git a/charts/datahub/templates/datahub-upgrade/datahub-upgrade-job.yml b/charts/datahub/templates/datahub-upgrade/datahub-upgrade-job.yml index 248bd0ad9..51550f81b 100644 --- a/charts/datahub/templates/datahub-upgrade/datahub-upgrade-job.yml +++ b/charts/datahub/templates/datahub-upgrade/datahub-upgrade-job.yml @@ -16,13 +16,19 @@ metadata: "helm.sh/hook-delete-policy": before-hook-creation spec: template: - {{- if .Values.global.podLabels }} + {{- if or .Values.global.podLabels .Values.datahubUpgrade.podAnnotations}} metadata: + {{- with .Values.datahubUpgrade.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.podLabels }} labels: - {{- range $key, $value := .Values.global.podLabels }} + {{- range $key, $value := . }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} + {{- end }} spec: {{- with .Values.global.hostAliases }} hostAliases: diff --git a/charts/datahub/templates/elasticsearch-setup-job.yml b/charts/datahub/templates/elasticsearch-setup-job.yml index 61ccabd11..612f48d3c 100644 --- a/charts/datahub/templates/elasticsearch-setup-job.yml +++ b/charts/datahub/templates/elasticsearch-setup-job.yml @@ -16,13 +16,19 @@ metadata: "helm.sh/hook-delete-policy": before-hook-creation spec: template: - {{- if .Values.global.podLabels }} + {{- if or .Values.global.podLabels .Values.elasticsearchSetupJob.podAnnotations }} metadata: + {{- with .Values.elasticsearchSetupJob.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.podLabels }} labels: - {{- range $key, $value := .Values.global.podLabels }} + {{- range $key, $value := . }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} + {{- end }} spec: {{- with .Values.global.hostAliases }} hostAliases: diff --git a/charts/datahub/templates/kafka-setup-job.yml b/charts/datahub/templates/kafka-setup-job.yml index 99115f04b..7d907e5e9 100644 --- a/charts/datahub/templates/kafka-setup-job.yml +++ b/charts/datahub/templates/kafka-setup-job.yml @@ -16,13 +16,19 @@ metadata: "helm.sh/hook-delete-policy": before-hook-creation spec: template: - {{- if .Values.global.podLabels }} + {{- if or .Values.global.podLabels .Values.kafkaSetupJob.podAnnotations }} metadata: + {{- with .Values.kafkaSetupJob.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.podLabels }} labels: - {{- range $key, $value := .Values.global.podLabels }} + {{- range $key, $value := . }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} + {{- end }} spec: {{- with .Values.global.hostAliases }} hostAliases: diff --git a/charts/datahub/templates/mysql-setup-job.yml b/charts/datahub/templates/mysql-setup-job.yml index 51b1dba3a..7f4097351 100644 --- a/charts/datahub/templates/mysql-setup-job.yml +++ b/charts/datahub/templates/mysql-setup-job.yml @@ -16,13 +16,19 @@ metadata: "helm.sh/hook-delete-policy": before-hook-creation spec: template: - {{- if .Values.global.podLabels }} + {{- if or .Values.global.podLabels .Values.mysqlSetupJob.podAnnotations }} metadata: + {{- with .Values.mysqlSetupJob.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.podLabels }} labels: - {{- range $key, $value := .Values.global.podLabels }} + {{- range $key, $value := . }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} + {{- end }} spec: {{- with .Values.global.hostAliases }} hostAliases: diff --git a/charts/datahub/templates/postgresql-setup-job.yml b/charts/datahub/templates/postgresql-setup-job.yml index bac141368..107a905f3 100644 --- a/charts/datahub/templates/postgresql-setup-job.yml +++ b/charts/datahub/templates/postgresql-setup-job.yml @@ -16,13 +16,19 @@ metadata: "helm.sh/hook-delete-policy": before-hook-creation spec: template: - {{- if .Values.global.podLabels }} + {{- if or .Values.global.podLabels .Values.postgresqlSetupJob.podAnnotations }} metadata: + {{- with .Values.postgresqlSetupJob.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.podLabels }} labels: - {{- range $key, $value := .Values.global.podLabels }} + {{- range $key, $value := . }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} + {{- end }} spec: {{- with .Values.global.hostAliases }} hostAliases: