Argo CD ApplicationSet and Git Generator: When Does Pruning Delete Child Applications?
0 reputation · 23 Jan 2022, 06:06 UTC
0 reputation · 23 Jan 2022, 06:06 UTC
The Argo CD ApplicationSet controller pairs with the Git generator to create Application resources from JSON or YAML files stored in a repository path. A single templated ApplicationSet can fan out applications across many target clusters, and the controller reconciles child Applications as the generator source changes.
The prune mechanism keeps generated Applications aligned with the generator output: when an entry disappears from the Git source file, the corresponding child Application is deleted. What remains unclear is how this behaves under real-world Git activity, such as high-frequency commits, partial pushes, or repository reorganizations that temporarily reduce the number of generated entries.
34775 reputation · 23 Jan 2022, 09:00 UTC
Pruning deletes a child Application when the ApplicationSet controller’s next successful reconciliation finds that the Git generator no longer emits the parameter set that created it. The controller matches child Applications by the argocd.argoproj.io/applicationset-name label and deletes the match unless spec.prune is explicitly false. It does not evaluate every intermediate commit; it reads the repository state at the configured ref, branch, tag, or commit during its periodic resync.
| Item | Status | Detail |
|---|---|---|
| Prune trigger | Confirmed | Missing generator output at the next successful reconciliation, for an ApplicationSet-owned child Application. |
| Per-commit pruning | Confirmed | Not supported; intermediate or high-frequency pushes are not individually observed. |
| Delay or approval gate | Confirmed | No native grace period, retention window, or manual approval; only spec.prune: false. |
| Temporarily fewer entries | Likely explanation | Next successful reconciliation prunes the now-missing child Applications; a failed Git read generally preserves the previous generation until the next successful run. |
| Orphaned Applications | Confirmed | With spec.prune: false, previously generated children remain and are not automatically re-adopted if the entry later reappears. |
kubectl get applicationset -n <namespace> <name> -o yaml and confirm spec.prune and spec.generators[].git.spec.prune: false on the ApplicationSet. Expect previously generated child Applications to remain orphaned.What is the installed Argo CD ApplicationSet controller version? This changes the expected reconciliation interval and may change default pruning behavior, so it affects whether the observed deletion timing is normal.
Review controller logs around the reconciliation window: kubectl logs -n argocd deployment/argocd-applicationset-controller --tail=100. Look for Git generator read errors and delete events for child Applications. If logs show a failed repository read, treat the previous generation as unchanged until the next successful run.
Assumption: this answer covers ApplicationSet-level pruning only. It does not cover Application sync-policy prune options, which are a separate mechanism.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.