argoproj / argo-cd

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

Ability to disable Server Side Apply on individual resource level #20306

Open motoki317 opened 1 week ago

motoki317 commented 1 week ago

Summary

In the doc below, there is a way to set the sync option ServerSideApply=true on individual resource level, when the Application doesn't have ServerSideApply enabled. https://argo-cd.readthedocs.io/en/latest/user-guide/sync-options/#server-side-apply

However, there doesn't seem to be a way to set ServerSideApply=false on individual resources when the Application has ServerSideApply=true set. Setting annotation to argocd.argoproj.io/sync-options: ServerSideApply=false to individual resources didn't achieve this behavior. The resource was still being applied via Server Side Apply (kubectl.kubernetes.io/last-applied-configuration annotation was not set).

Motivation

This feature would be useful if users want to enable Server Side Apply on the Application level, but want to disable it for some resources. For example, one may have multiple large CRD resources which require SSA to apply so it would be useful to set SSA enabled on Application level, but want to disable it for other resources in the same Application for some reason.

One reason that I would like to disable SSA for specific resources in the same Application is described in the following issue: https://github.com/argoproj/argo-rollouts/issues/3437 Argo Rollouts does not work if ArgoCD auto-heals Service resources via SSA, because while Argo Rollouts adds a field inside .spec.selector, ArgoCD overwrites the entire .spec.selector object, conflicting with Rollouts controller behavior, resulting in the issue above.

Proposal

If I have an Application with ServerSideApply=true set, individual resources inside the Application should be able to set argocd.argoproj.io/sync-options: ServerSideApply=false to disable SSA for the resources.

crenshaw-dev commented 1 week ago

I think this is a bug. The behavior you're describing seems a lot more intuitive.