argoproj / argo-cd

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

Switch to ignore FailOnSharedResource for one manual sync #18236

Open RobinsonZ opened 2 weeks ago

RobinsonZ commented 2 weeks ago

Summary

There should be a switch to ignore the FailOnSharedResource option for a single manual sync.

Motivation

In general, we want to have the FailOnSharedResource option enabled at all times to protect from accidental resource conflicts, particularly those caused by automated processes. However, there are limited cases where we actually want to transfer a resource from one Application to another. In particular, sometimes the original Application has been deleted or is no longer managing those resources but has not pruned them, so they still exist in the cluster with annotations for an app that no longer exists.

We use a monorepo where folders correspond to Applications generated by a GitGenerator. Currently, a folder rename in a repository breaks all syncs for that app until FailOnSharedResource is disabled for the new application and the application is manually synced. This is particularly painful because there's no GUI option to disable or enable FailOnSharedResource, so the edit must be made by hand-editing the manifest. (And the parent ApplicationSet might need to be configured to ignore the changes as well.)

Proposal

From my understanding of the code, the default sync options of the application are overwritten here by any sync options that are specified in the API call. Currently, the UI passes along all sync options that are set in the sync request (or, more to the point, it doesn't have a GUI option for FailOnSharedResource, so you can't disable it manually). My proposal is to implement an option in the UI that allows the FailOnSharedResource=true option to not be sent with the sync request for a given sync.

RobinsonZ commented 2 weeks ago

Also, see #7444 where FailOnSharedResource (but evidently not the GUI support for it) was added.