`argocd version` and other commands result in error when not in argocd namespace, even with `--namespace` option
- Dominant language
- Go
- Stars
- 24.2k
- Forks
- 7.8k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 239
Description
Checklist:
* [X] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
* [X] I've included steps to reproduce the bug.
* [X] I've pasted the output of `argocd version`.
**Describe the bug**
While not in the `argocd` namespace, the command `argocd version --namespace argocd` fails with the error `FATA[0001] configmap "argocd-cm" not found`. This started to happen after updating the Argo CD CLI. We're using the core install.
**To Reproduce**
1. Set the namespace of your current K8s context to something other than `argocd` (i.e. the NS where Argo CD is installed).
2. Run `argocd version --namespace argocd`
**Expected behavior**
No error occurs.
**Screenshots**
**Version**
```shell
argocd: v2.5.2+148d8da.dirty
BuildDate: 2022-11-07T18:41:19Z
GitCommit: 148d8da7a996f6c9f4d102fdd8e688c2ff3fd8c7
GitTreeState: dirty
GoVersion: go1.19.3
Compiler: gc
Platform: linux/amd64
argocd-server: v2.5.2+148d8da.dirty
BuildDate: 2022-11-07T18:41:19Z
GitCommit: 148d8da7a996f6c9f4d102fdd8e688c2ff3fd8c7
GitTreeState: dirty
GoVersion: go1.19.3
Compiler: gc
Platform: linux/amd64
Kustomize Version: v4.5.5 2022-05-20T20:21:22Z
Helm Version: v3.9.3+g414ff28
Kubectl Version: v0.24.2
Jsonnet Version: v0.18.0
```
**Logs**
```
Paste any relevant application logs here.
```
Contributor guide
Research direction
Reproduce the failure with the current Kubernetes context set to a namespace other than argocd, then run `argocd version --namespace argocd`. Trace the `argocd version` command's configmap lookup and verify that the supplied namespace is used; done means the command completes without the `argocd-cm` not-found error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100