From e918aa43669d83e096d0eb872b5e443288818c7a Mon Sep 17 00:00:00 2001 From: Sebastien Termeau Date: Thu, 17 Oct 2024 16:08:16 +0200 Subject: [PATCH] Helm Chart: Added ability to specify extra annotations to the SQLMigration job (#22781) Added the ability to add extra annotations to the SQL migration job This is required for ArgoCD to properly handle the Job after it has been deleted See https://argo-cd.readthedocs.io/en/stable/user-guide/resource_hooks/#hook-deletion-policies --- charts/fleet/templates/job-migration.yaml | 7 ++++--- charts/fleet/values.yaml | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/charts/fleet/templates/job-migration.yaml b/charts/fleet/templates/job-migration.yaml index 135dac9a63..cd2e963712 100644 --- a/charts/fleet/templates/job-migration.yaml +++ b/charts/fleet/templates/job-migration.yaml @@ -10,13 +10,14 @@ metadata: name: fleet-migration namespace: {{ .Release.Namespace }} annotations: - {{- if .Values.mysql.enabled }} - {} - {{- else }} + {{- if not .Values.mysql.enabled }} "helm.sh/hook": pre-install,pre-upgrade "helm.sh/hook-weight": "1" "helm.sh/hook-delete-policy": hook-succeeded {{- end }} + {{- with .Values.fleet.migrationJobAnnotations }} + {{- toYaml . | trim | nindent 4 }} + {{- end }} spec: ttlSecondsAfterFinished: 100 template: diff --git a/charts/fleet/values.yaml b/charts/fleet/values.yaml index dfa0df541a..d18d5d457f 100644 --- a/charts/fleet/values.yaml +++ b/charts/fleet/values.yaml @@ -65,6 +65,8 @@ fleet: secretName: fleet # Whether or not to run `fleet db prepare` to run SQL migrations before starting Fleet autoApplySQLMigrations: true + # Add extra annotations to the migration Job + migrationJobAnnotations: tls: enabled: true # Set to true if you need a separate secret for just TLS data.