Skip to content

Add option to set extra annotations on db-migrator job (chart) - #4954

Merged
tegioz merged 1 commit into
artifacthub:masterfrom
tibuntu:db-migrator-job-annotations
Nov 18, 2026
Merged

tegioz merged 1 commit into
artifacthub:masterfrom
tibuntu:db-migrator-job-annotations

Conversation

@tibuntu

@tibuntu tibuntu commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

When the chart is deployed with Argo CD, .Release.IsInstall is always true. So the db-migrator Job is always rendered as a regular resource called db-migrator-install, never as the pre-upgrade hook. Each chart upgrade changes the Job's image, and since a Job's spec.template can't be changed, Argo CD's patch fails with:

Job.batch "db-migrator-install" is invalid: spec.template: Invalid value: ...: field is immutable

The only workaround today is to delete the Job by hand before each upgrade.

This adds dbMigrator.job.extraJobAnnotations, the annotation counterpart of the existing extraJobLabels. Users can then set tool-specific annotations, for example:

dbMigrator:
  job:
    extraJobAnnotations:
      argocd.argoproj.io/sync-options: Force=true,Replace=true

so Argo CD recreates the Job instead of patching it. On upgrade the extra annotations are added next to the existing Helm hook annotations. Nothing changes when the value isn't set.

Signed-off-by: Timo Hankamer <timo.hankamer@tibuntu.dev>

@tegioz tegioz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tibuntu 👍

@tegioz
tegioz merged commit d3b83e1 into artifacthub:master Nov 18, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants