Sync waves control the order in which resources are applied during a sync. Each resource can carry an annotation `argocd.argoproj.io/sync-wave` with an integer; ArgoCD applies lower waves first and waits for each wave's resources to become Healthy before the next. This orders dependencies like namespaces, CRDs, databases, then apps.
The default wave is 0 when no annotation is set. Negative waves run before wave 0, which is handy for prerequisites like CRDs, namespaces, or operators that must exist before everything else. Ordering runs from the lowest (most negative) to the highest wave.
metadata:
annotations:
argocd.argoproj.io/sync-wave: "-1" # CRDs before workloads
Real-world example
CRDs are annotated wave -1 so they install before any custom resources in the default wave 0.
Likely follow-ups
Why put CRDs in a negative wave? | What order do waves run in?
Hooks are resources (usually Jobs or Pods) that run at specific points in a sync to perform tasks like migrations, tests, or notifications. They're marked with `argocd.argoproj.io/hook` and a phase (PreSync, Sync, PostSync, SyncFail, Skip). ArgoCD runs them at the right time and tracks their success as part of the sync.
PreSync runs before the main sync (e.g., DB migration). Sync runs alongside the normal resources. PostSync runs after all resources are applied and Healthy (e.g., smoke tests, notifications). SyncFail runs if the sync fails (cleanup/alert). Skip means don't apply the resource. Phases let you inject logic around the deployment.
metadata:
annotations:
argocd.argoproj.io/hook: PostSync # smoke tests after deploy
Real-world example
A PostSync hook runs integration smoke tests only after the app is deployed and healthy; a SyncFail hook alerts on failure.
Likely follow-ups
When does PostSync run relative to health? | What is the SyncFail phase for?
Hooks also honor sync waves, so you can order hooks relative to each other and to resources. Within a phase, waves determine order. PreSync hooks run (in wave order) before Sync-phase resources; PostSync hooks run after all Sync resources are Healthy. This lets you build precise ordered pipelines within a single sync.
Hook deletion policies control when hook resources (like Jobs) are cleaned up: HookSucceeded (delete after success), HookFailed (delete after failure), or BeforeHookCreation (delete the previous hook instance before creating a new one). They prevent accumulation of completed Job objects and manage reruns.
Use a PreSync hook Job that runs the migration; ArgoCD waits for it to complete successfully before applying the new app version (in a later phase/wave). If the migration fails, the sync fails and the new version isn't rolled out, protecting against deploying code against an unmigrated schema.
Sync waves order the ongoing desired-state resources that ArgoCD keeps reconciled. Hooks are transient, run per-sync (often deleted afterward), and tie to phases/failure—ideal for imperative one-off tasks like migrations or tests. Use waves for ordering persistent resources; use hooks for actions that should run around a sync but not be permanently managed.
Real-world example
Persistent components use waves for ordering, while a one-time cache warm-up runs as a PostSync hook that's deleted after success.
Likely follow-ups
Why are hooks better for one-off tasks? | Are hooks part of the desired state?
Assign ascending waves by dependency: namespaces/CRDs (wave -1/0), configuration and secrets (wave 0), stateful backends like databases (wave 1) with a readiness gate, then backend services (wave 2), then frontends (wave 3). ArgoCD waits for each wave to be Healthy, ensuring dependencies are ready before dependents deploy.
A resource annotated with hook Skip is not applied by ArgoCD during sync—useful to keep a manifest in the repo for reference or manual application without ArgoCD managing it. It effectively excludes the resource from the sync while keeping it version-controlled.