argoproj / argo-cd

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

ArgoCD rollback command to support `kubectl undo` #6404

Open ozooxo opened 3 years ago

ozooxo commented 3 years ago

Summary

We would like to support using kubectl rollout undo deploy <name> --to-revision=1 and kubectl argo collouts undo <name> when we rollback.

Motivation

Looks like right now rollback is part of appStateManager.SyncAppState() (by this else condition). As it finally goes to syncContext.Sync(), there will be no difference on sync in the argoproj/gitops-engine level and it will always be a kubectl replace.

We wonder if there's a possibility for rollback to support a different path other than sync, so we can actually use kubectl commands like kubectl rollout undo deploy <name> --to-revision=1 or kubectl argo collouts undo <name> when we rollback?

Proposal

I think we'll need to expand argoproj/gitops-engine to support those kubectl * undo commands, and in ArgoCD controller to redirect rollback to a different path.

jessesuen commented 3 years ago

What is wrong with the existing rollback mechanism?

image

ozooxo commented 3 years ago

@jessesuen From reading your src, I think your rollback calls appStateManager.SyncAppState() (by this else condition) and it finally goes to kubectl replace with an old SHA (not the GitOps repo HEAD), but not kubectl undo. No?