Application Pruning & Resource Deletion¶
Application resources created by the ApplicationSet controller (from an ApplicationSet) will contain:
.metadata.ownerReferencesreference back to the parent
- An Argo CD
.metadata.finalizersof the Application if
.syncPolicy.preserveResourcesOnDeletionis set to false.
The end result is that when an ApplicationSet is deleted, the following occurs (in rough order):
ApplicationSetresource itself is deleted
Applicationresources that were created from this
ApplicationSet(as identified by owner reference)
- Any deployed resources (
ConfigMaps, etc) on the managed cluster, that were created from that
Applicationresource (by Argo CD), will be deleted.
- Argo CD is responsible for handling this deletion, via the deletion finalizer.
- To preserve deployed resources, set
.syncPolicy.preserveResourcesOnDeletionto true in the ApplicationSet.
Thus the lifecycle of the
Application, and the
Application's resources, are equivalent.
See also the controlling resource modification page for more information about how to prevent deletion or modification of Application resources by the ApplicationSet controller.
It is still possible to delete an
ApplicationSet resource, while preventing
Applications (and their deployed resources) from also being deleted, using a non-cascading delete:
kubectl delete ApplicationSet (NAME) --cascade=orphan
Even if using a non-cascaded delete, the
resources-finalizer.argocd.argoproj.io is still specified on the
Application. Thus, when the
Application is deleted, all of its deployed resources will also be deleted. (The lifecycle of the Application, and its child objects, are still equivalent.)
To prevent the deletion of the resources of the Application, such as Services, Deployments, etc, set
.syncPolicy.preserveResourcesOnDeletion to true in the ApplicationSet. This syncPolicy parameter prevents the finalizer from being added to the Application.