github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/applicationset/Application-Deletion.md (about)

     1  # Application Pruning & Resource Deletion
     2  
     3  All `Application` resources created by the ApplicationSet controller (from an ApplicationSet) will contain:
     4  
     5  - A `.metadata.ownerReferences` reference back to the *parent* `ApplicationSet` resource
     6  - An Argo CD `resources-finalizer.argocd.argoproj.io` finalizer in `.metadata.finalizers` of the Application if `.syncPolicy.preserveResourcesOnDeletion` is set to false.
     7  
     8  The end result is that when an ApplicationSet is deleted, the following occurs (in rough order):
     9  
    10  - The `ApplicationSet` resource itself is deleted
    11  - Any `Application` resources that were created from this `ApplicationSet` (as identified by owner reference)
    12  - Any deployed resources (`Deployments`, `Services`, `ConfigMaps`, etc) on the managed cluster, that were created from that `Application` resource (by Argo CD), will be deleted.
    13      - Argo CD is responsible for handling this deletion, via [the deletion finalizer](../../../user-guide/app_deletion/#about-the-deletion-finalizer).
    14      - To preserve deployed resources, set `.syncPolicy.preserveResourcesOnDeletion` to true in the ApplicationSet.
    15  
    16  Thus the lifecycle of the `ApplicationSet`, the `Application`, and the `Application`'s resources, are equivalent.
    17  
    18  !!! note
    19      See also the [controlling resource modification](Controlling-Resource-Modification.md) page for more information about how to prevent deletion or modification of Application resources by the ApplicationSet controller.
    20  
    21  It *is* still possible to delete an `ApplicationSet` resource, while preventing `Application`s (and their deployed resources) from also being deleted, using a non-cascading delete:
    22  ```
    23  kubectl delete ApplicationSet (NAME) --cascade=orphan
    24  ```
    25  
    26  !!! warning
    27      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.)
    28  
    29      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.