ArgoCD › Sync Waves & Hooks

How are hook resources named and prevented from clashing across syncs?

Intermediate

Answer

Hooks are typically generated with unique names (e.g., using generateName) or cleaned up via BeforeHookCreation so a new sync doesn't collide with a leftover from a prior run. Because Jobs are immutable in key fields, reusing a fixed name without deletion causes apply errors, so deletion policies or unique names are important.
metadata:
  generateName: migrate-
  annotations:
    argocd.argoproj.io/hook: PreSync
    argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
Real-world example Each sync's migration Job gets a unique generated name, avoiding conflicts with the previous run's Job.

Common follow-ups: Why do fixed-name Jobs cause conflicts? | What does BeforeHookCreation prevent?