argoproj / argo-cd

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

Prevent unintended usage of "replace" #14161

Open mattenklicker opened 1 year ago

mattenklicker commented 1 year ago

Summary

Make it possible to prevent the unintended usage of "replace" in UI sync options.

Motivation

To update resources by "kubectl replace" is dangerous under certain conditions. It already has a warning sign, but some might want to disable the usage completely. See https://github.com/argoproj/argo-cd/issues/9767 also. It is very present in UI sync options and unfortunately it is likely impossible to block "replace" through kubernetes RBAC or other measures like OPA.

Proposal

fhopfensperger commented 1 year ago

I am also looking for something like this. It would be nice to be able to customize the sync options per application.

image
pranchals commented 8 months ago

Implementing RBAC for Sync Options would be good addition and will enforce stricter access controls and define precise permissions with regards synchronisation actions within an Argo CD Application.

Is there any update on this being implemented ?

conman2305 commented 1 month ago

I'll +1 this - I want to give users the ability to sync their apps, but doing so currently also means they can totally wipe it out. It'd be nice to implement fine-grained controls for the sync permission like there is for update and delete: https://argo-cd.readthedocs.io/en/stable/operator-manual/rbac/#fine-grained-permissions-for-updatedelete-action

jeremyrajan commented 1 month ago

Is there a way around it? Can I give sync permissions but don't allow replace?

todaywasawesome commented 2 days ago

@jeremyrajan not today

andrii-korotkov-verkada commented 2 days ago

I'm planning to work on this an implement an option in the config which allows to hide the button. UI would query that data from the backend and not render a button at all if configured so.

andrii-korotkov-verkada commented 2 days ago

Extra UI friction may not be as helpful, since people may ignore it anyways as they can ignore the warning icon near the checkbox.

andrii-korotkov-verkada commented 2 days ago

@todaywasawesome, which configmap is best for putting the option in? Is it argocd-cm or some other?

andrii-korotkov-verkada commented 10 hours ago

Seems like RBAC already has a support for rules about resource deletion https://argo-cd.readthedocs.io/en/stable/operator-manual/rbac/#fine-grained-permissions-for-updatedelete-action. Somebody brought this up during the contributors meeting, that checking for resource deletion permission can be done. Given possibility to customize like above, I think it will solve the problem.