Interview Prep/Helm/Hooks, Tests, GitOps & Secrets

On upgrade, the migration Job runs the **old** SQL even though the chart contains new migration files.

AdvancedTroubleshootingHooks, Tests, GitOps & Secrets
Answer

Likely causes → The SQL lives in a regular ConfigMap, which is updated only after pre-upgrade hooks run, so the Job mounts the previous version.

Diagnose → kubectl get cm shop-migrations -n shop -o yaml during the hook shows old content.

Fix → Make the migrations ConfigMap a hook too (pre-upgrade, weight -5, before-hook-creation) so it is created before the Job (weight 0), or bake migrations into the migration image.

Prevent → Remember that pre-* hooks see the old state of regular resources.

All Helm questions Roadmap: Helm

More on Hooks, Tests, GitOps & Secrets