Ability to disable Server Side Apply on individual resource level
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.
I think this is a bug. The behavior you're describing seems a lot more intuitive.
It happens because
serverSideApply := !dryRun && (sc.serverSideApply || resourceutil.HasAnnotationOption(t.targetObj, common.AnnotationSyncOptions, common.SyncOptionServerSideApply))
Where sc.serverSideApply is taken from application. So in such case it always will be true
But for me it also looks like a bug, i will open PR and we can discuss it
Reopening it, because i still need upgrade ArgoCD with new engine version