argoproj / argo-cd

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

Enable cli to work completely independently of Argo CD auth #12184

Open jsoref opened 1 year ago

jsoref commented 1 year ago

Summary

Make the CLI work completely independently of Argo CD auth. Communicate directly with k8s using your local kube config

Motivation

We use argo-helm's argo-cd helm charts, e.g. https://github.com/argoproj/argo-helm/releases/tag/argo-cd-5.19.9 to deploy argo-cd, and it's one of the applications that argo-cd manages.

Generally, argo-cd is self-healing. If I make a mistake, I can just push to git and argo-cd refreshes it, applies, and I'm happy.

argo-cd is configured to run the controller as a statefulset (we switched because of https://github.com/argoproj/argo-helm/tree/main/charts/argo-cd#210x-to-2110). Occasionally we end up in states where that statefulset doesn't start, this could be because we misconfigured the imageRepo/imageTag or for some other reason (one case was when we actually switched from the deployment to the statefulset, the controller went missing). As part of various things, the controller will end up stopping and expecting to start again to continue processing things, but if it fails to start, there's nothing left to self-heal.

Proposal

@crenshaw-dev suggested:

Make the CLI work completely independently of Argo CD auth. Communicate directly with k8s using your local kube config

andrii-korotkov-verkada commented 1 week ago

What would be the difference with using kubectl for these cases?

jsoref commented 1 week ago

The argocd cli does various things, e.g. https://argo-cd.readthedocs.io/en/latest/user-guide/commands/argocd_app/ those should just work. If the commands didn't need to exist because kubectl existed, then they wouldn't exist, but clearly someone though they were useful.

andrii-korotkov-verkada commented 1 week ago

I just don't know how easy this would be to implement. E.g. take a command argocd app sync. It needs to set specific configuration, which is normally handled by the backend. So I don't think a generic problem can be solved. However, can you come up with some minimal list of commands you'd like supported like this and we can evaluate what would it take?

jsoref commented 1 week ago

It's hard for me to say right now. I know I want to be able to use the cli, but I can't because of this. I filed this because @crenshaw-dev suggested it's possible, so I figured he'd have enough ideas of how to make it work.