-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Description
Description
Option to exclude default / hard-coded helm annotations for jobs and other relevant templates.
Use case / motivation
Ability to exclude default helm annotations will make it easier to use tools such as ArgoCD and its Helm integration to manage deployments.
ArgoCD has some understanding of Helm annotations ArgoCD docs but wants us to override certain things like "hook-weight" to make sure the resource is created at the right time.
Currently it is not possible to avoid the default annotations being created and we have tested to add-on the ArgoCD specific annotations but they don't override the default ones.
Which results in ArgoCD deployments not working due to e.g. deployments waiting forever for the db migration job to complete (which doesn't run).
Are you willing to submit a PR?
Possibly, new to Helm and unsure how I can actually test it out : )
Not been able to test this yet but started to work on a potential solution to this; adding defaultJobAnnotations: true configuration attribute.
Example:
config:
migrateDatabaseJob:
defaultJobAnnotations: false
jobAnnotations:
"argocd.argoproj.io/hook": PostSync
createUserJob:
defaultJobAnnotations: false
jobAnnotations:
"argocd.argoproj.io/hook": PostSync
Which could be used like this in the template:
annotations:
{{- if .Values.migrateDatabaseJob.defaultJobAnnotations }}
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
{{- end }}
{{- if .Values.migrateDatabaseJob.jobAnnotations }}
{{- toYaml .Values.migrateDatabaseJob.jobAnnotations | nindent 4 }}
{{- end }}