Respect `controller` flag in owner references
mkjpryor opened this issue · 4 comments
Summary
Currently, Argo CD only considers resources with no owner references as top-level resources, and hence refuses to delete objects that have any owner references.
I would like to have a configuration and/or sync option to say that only owner references with controller: true
should be respected when determining whether a resource is a top-level resource and can be deleted by Argo.
Motivation
I would like to use Argo CD to manage Cluster API clusters, but Cluster API adds owner references with controller: false
to all resources that are part of a cluster but not directly managed by Cluster API (in particular, MachineDeployment
s). This means that Argo CD refuses to delete those resources even though it created them and there are no other controllers managing them.
I believe that that this is the correct behaviour from Cluster API, as those resources do indeed have a dependency on the Cluster
object but Cluster API is not responsible for managing their lifecycle (other than cascade deletion).
Currently, this is a massive blocker for anyone who wants to use Argo CD to manage Cluster API clusters.
Proposal
I would like to see an additional sync option, RespectControllerReferencesOnly=true
, that can be set on an application to enable this behaviour.
I'm happy to have a go at a patch, but am struggling to find where in the code I can implement this that has access to the sync options for the app but is also able to influence the owner references.
My first thought was resolveResourceReferences
(https://github.com/argoproj/gitops-engine/blob/31311943a57a45389dc01412572356f2fdbca128/pkg/cache/references.go#L21), but I am struggling to see how to pass in a sync option.
so no one woking on this?