Open ein-stein-chen opened 9 months ago
+1 to this proposal.
+1
Would be nice to have this as some of the resources are moved to being provisioned for example by terraform instead.
+1 I'd love to have that available
+1 this would be really useful, especially for namespaces that may be referenced in multiple applications
Am I correct in understanding that this is a workaround for doing a one-time disown:
app.kubernetes.io/instance
label from the resourceI can't speak for the original author, but this is what I do:
for wf in $( kubectl --namespace argocd get application "$1" -o yaml | yq eval '.status.resources[] | select(.kind == "Workflow" and .requiresPruning) | .name' - ) ; do
kubectl patch workflow $wf --type=merge -p '{"metadata":{"labels":{"app.kubernetes.io/instance":null}}}'
done
you also need to get rid of the annotation
annotations:
argocd.argoproj.io/tracking-id: <app>:/Namespace:argocd-demo-project/test-argo-keep-ns
Maybe an annotation like resourceTrackingMethod: none
that we add on a resource, so ArgoCD would create it without labels/annotations for tracking ?
This would be like creating the resource from outside the ArgoCD Apps... but it will not appear in the UI...
This would be like creating the resource from outside the ArgoCD Apps... but it will not appear in the UI...
I can't speak for the original author of this issue, but that's definitely not a feature I'm interested in.
I would vote for this feature that could allow resources to be disowned by ArgoCD, or they'll always appears to be out-of-sync if we don't actually want to delete them..
Summary
Provide an option on the Application and/or Resource level so that ArgoCD will never delete a resource but only disown it (by removing the tracking label/annotation e.g.
app.kubernetes.io/instance
).If the resource used server-side-apply then ArgoCD should remove all fields it managed.
Motivation
If Argo CD is used to patch existing resources in the cluster which are not created by Argo CD itself, it would create problems if Argo CD would delete the resource.
Example:
Using Argo CD for managing custom labels on cluster nodes.
This can be achieved by creating an Application with the sync option
ServerSideApply=true
and then creating a (or templating) partialNode
objects that only contain the labels we want to set.But this makes it rather easy to accidentally delete the node (either by directly deleting the
Node
via the UI or when theApplication
is deleted or during sync when pruning and the file was removed).It is already possible to work around some of those problems, by not setting
finalizers
on theApplication
and adding theargocd.argoproj.io/sync-options: "Delete=false,Prune=false"
annotation.But this will (only) leave the option to delete the
Node
via the UI while it is not easily possible to simply tell Argo CD to disown theNode
which will then stay in the UI asOutOfSync
forever.Also, it would be nice to remove all the fields Argo CD set/managed when disowning the node.
Proposal
Add a sync option on the
Resource
level (e.g.Disown
) that can be one of:no
(Default)only
(Only remove the tracking label/annotation whenpruning
anddeleting
a resource)andRemoveManagedFields
(Also remove all fields managed by Argo CD when using server-side-apply)Related
2437
3984
5945