A `post-install` hook seeds demo data; it ran again on every upgrade and duplicated rows. Why?
IntermediateScenarioHooks, Migrations & Testing
Answer
Situation read → The hook annotation probably lists post-install,post-upgrade, or the seed is not idempotent.
What I'd do →
- Restrict to
post-installif seeding is a one-time action. - Make the seed idempotent (
INSERT ... ON CONFLICT DO NOTHING). - Note: under Argo CD,
post-installmaps toPostSync, which runs on every sync, so idempotency is mandatory there.
Why → Hooks can run more often than you expect; design them to be safe on repeat.
Interview tip → Mention the Argo CD mapping.
More on Hooks, Migrations & Testing
Design database migrations for a Helm-deployed app where the database is a subchart.IntermediateThe migration Job takes 12 minutes on prod data and the upgrade times out. What do you change?IntermediateA migration hook failed and the Job pod was deleted, so you cannot see why. How do you fix the chart?BeginnerYou want a backup before every production upgrade. How do you do it with Helm?IntermediateHow do you clean up external resources (DNS records, S3 buckets) when a release is uninstalled?AdvancedWhat would you put in `helm test` for a 3-tier app?Intermediate