Sync prune and self-heal
Separate synchronization from deletion
With manual synchronization, an operator chooses when to request a sync. Automated synchronization can apply a newly detected desired revision without that manual step. Pruning removes managed resources no longer in the desired set; it is separate from applying resources. Automated pruning and self-healing are not enabled merely because an Application exists. The sample starts with automation explicitly disabled; check the installed Argo CD version for the enabled field.
syncPolicy: automated: enabled: false prune: false selfHeal: false allowEmpty: falseDecide what to do with drift
Self-healing lets Argo CD initiate an automated correction for live-only drift when automation is active. Without it, a live-only edit does not by itself trigger automated synchronization in the simple single-source case; later source changes or a manual sync can still overwrite drift. Failed operations, revision tracking, retries, sync windows and controller conditions complicate the real behavior. This lesson uses a simplified decision table for otherwise eligible operations, not a simulator of the actual controller.
New source revision + auto enabled -> eligible to syncLive-only drift + auto enabled + selfHeal -> eligible to syncLive-only drift + auto enabled + no selfHeal -> no drift-only automatic syncTreat prune as a destructive operation
A removed ConfigMap may be disposable; a removed PVC may lead to lost data depending on the storage reclaim policy and deletion behavior. Before allowing pruning, inspect the proposed deletion list and verify dependencies, backups and restoration evidence. For an automated prune, allowEmpty is a guard against a completely empty desired set, not a safeguard for each resource. Per-resource Prune=false or Prune=confirm can prevent or require approval for selected deletion operations. Application deletion with cascading finalizers is a separate lifecycle concern.
metadata: annotations: argocd.argoproj.io/sync-options: Prune=confirmSequence changes and verify the outcome
Sync hooks and waves help arrange dependencies; lower-numbered waves run before higher-numbered waves within the relevant phase. A PreSync check may block a sync when it fails, and a PostSync check can verify behavior after successful application and health checks. Hooks are not run during selective sync. Use short bounded Jobs with reviewed images and explicit cleanup. Git revert introduces a new reviewed desired revision; do not assume reverting configuration reverses a database migration. Coordinate recovery with the source of truth and verify readiness plus application responses.
PreSync: bounded checkSync wave -1: configurationSync wave 0: workloadPostSync: application smoke testPractice and next step
Inspect sync-cases.json and predict whether each case is eligible for automatic sync, whether pruning is blocked, and which objects need approval. Run the offline validator and explain why a PVC cannot be considered safe based only on allowEmpty=false. Next: ApplicationSet and environment promotion.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Sync prune and self-heal — knowledge check
Predict the effect of automated synchronization, pruning and self-healing, and review destructive changes before approval.
What does selfHeal enable in an otherwise eligible automated single-source application?
What does automatic prune remove?
What does allowEmpty=false guard against?
Which annotation value requests approval for pruning a resource?
A database migration is incompatible with the old application. What is a safe rollback decision?