argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.96k stars 5.47k forks source link

Annotation on child resources so ArgoCD doesn't delete them when parrent Application gets deleted #5945

Open JoaoBraveCoding opened 3 years ago

JoaoBraveCoding commented 3 years ago

Summary

Proposal is to introduce an annotation like:

metadata:
  annotations:
    argocd.argoproj.io/sync-options: Prune=false

That would prevent a resource from being deleted when we delete an Application. Currently, there is no way to leave orphaned resources without removing the finalizer from the Application

ArgoCD Version 1.7.11

Motivation

We deploy ArgoCD on Openshift to manage all our cluster configuration. There are some resources that we have to configure, but these resources can never be deleted from a cluster. However, in some use cases we want to reconfigure these resources with a different Application, however we cannot delete the old application as ArgoCD gets stuck in an infinite loop of trying to delete the old Application.

Proposal

Either update the deletion login to skip resources with the annotation:

metadata:
  annotations:
    argocd.argoproj.io/sync-options: Prune=false

Or simply introduce a new annotation:

metadata:
  annotations:
    argocd.argoproj.io/delete-options: Prune=false
JoaoBraveCoding commented 3 years ago

Change should probably be introduce somewhere around here

ghost commented 3 years ago

We've got a similar usecase here on OC 🎉

raolivei commented 1 year ago

+1