Interview Prep/GitOps & Argo CD/Sync Behaviour, Waves & Hooks

After enabling `prune: true`, someone renames a folder and the next sync would delete a production StatefulSet and its PVCs. How do you prevent this class of incident?

AdvancedScenarioSync Behaviour, Waves & Hooks
Answer

Situation read → Prune turns a refactoring mistake into data loss.

What I'd do →

  1. Annotate stateful resources and PVCs with argocd.argoproj.io/sync-options: Prune=false,Delete=false.
  2. Keep allowEmpty: false so an empty render cannot wipe an app.
  3. Add a CI check that runs argocd app diff --local or renders and compares resource counts on PRs to the config repo.
  4. Use Prune=confirm on critical resources so pruning needs a human click.
  5. Set StorageClass reclaimPolicy: Retain for important volumes.

Why → Defense in depth: GitOps automation should never be the only barrier before deleting data.

Interview tip → Mention PV Retain as the last line of defense.

All GitOps & Argo CD questions Roadmap: Argo CD (GitOps)

More on Sync Behaviour, Waves & Hooks