argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

argocd CLI admin cluster generate spec does not work in v2.4.9

Open mweibel opened this issue 2 years ago • 3 comments

Describe the bug When executing argocd admin cluster generate-spec clustername an error is printed instead of the cluster config. This used to work in an older version of argocd CLI.

To Reproduce

$ export KUBECONFIG=~/.kube/my-cluster 
$ argocd admin cluster generate-spec azure-eu-v2 |yq eval '.stringData.config' -|jq|yq eval - -P
FATA[0000] configmap "argocd-cm" not found              
null
$ argocd version
argocd: v2.4.11+3d9e9f2.dirty
  BuildDate: 2022-08-22T12:52:04Z
  GitCommit: 3d9e9f2f95b7801b90377ecfc4073e5f0f07205b
  GitTreeState: dirty
  GoVersion: go1.19
  Compiler: gc
  Platform: linux/amd64
FATA[0000] Argo CD server address unspecified    
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://RREDACTED
  name: my-cluster
contexts:
- context:
    cluster: my-cluster
    user: my-cluster-admin
  name: my-cluster-admin@my-cluster
current-context: my-cluster-admin@my-cluster
kind: Config
preferences: {}
users:
- name: my-cluster-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED

Expected behavior

$ argocd version
argocd: v2.2.11+aa3f374
  BuildDate: 2022-07-12T16:13:20Z
  GitCommit: aa3f3749f8d5f174d2e4cdd2cf14cf6f9ef55143
  GitTreeState: clean
  GoVersion: go1.16.11
  Compiler: gc
  Platform: linux/amd64
FATA[0000] Argo CD server address unspecified  
$ export KUBECONFIG=~/.kube/my-cluster 
$ argocd admin cluster generate-spec azure-eu-v2 |yq eval '.stringData.config' -|jq|yq eval - -P
tlsClientConfig:
  insecure: false
  certData: REDACTED
  keyData: REDACTED
  caData: REDACTED

mweibel avatar Aug 23 '22 08:08 mweibel

I was struggling with the same thing, but managed to solve it. Try first calling

argocd login --core

Then you can verify that argocd version and argocd cluster add xxx no longer produce the error "Argo CD server address unspecified".

iluwatar avatar Aug 24 '22 12:08 iluwatar

I'm sorry - maybe the issue description wasn't clear enough. The issue is not with argocd version, or argocd cluster add, or the error Argo CD server address unspecified. Instead, the issue is about argocd admin cluster generate-spec context not working, and erroring with FATA[0000] configmap "argocd-cm" not found. This works (still) in older (2.2.x) versions of the CLI but not in the newest (2.4.x) versions.

mweibel avatar Aug 24 '22 19:08 mweibel

same here with argocd admin cluster generate-spec FATA[0001] configmap "argocd-cm" not found

keramblock avatar Sep 12 '22 12:09 keramblock

I got the same error here :

20 terraform-voggt-bits-internal/modules/argocd ✗  argocd version
argocd: v2.4.13+19ec34e.dirty
  BuildDate: 2022-10-03T22:54:38Z
  GitCommit: 19ec34e134cac5e693ddd5f56844a946e6e1d44b
  GitTreeState: dirty
  GoVersion: go1.19.1
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.4.13+19ec34e.dirty
  BuildDate: 2022-10-03T22:54:38Z
  GitCommit: 19ec34e134cac5e693ddd5f56844a946e6e1d44b
  GitTreeState: dirty
  GoVersion: go1.19.1
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: could not get kustomize version: exec: "kustomize": executable file not found in $PATH
  Helm Version: v3.10.0+gce66412
  Kubectl Version: v0.23.1
  Jsonnet Version: v0.18.0
➜  argocd admin cluster generate-spec my-context
FATA[0000] configmap "argocd-cm" not found

KrustyHack avatar Oct 05 '22 13:10 KrustyHack

still persists

keramblock avatar Feb 01 '23 13:02 keramblock

I stumbled across this issue today. I think I know the reason too.

https://github.com/argoproj/argo-cd/blob/9b4f468f728d44ef4e90d5a1f9cc22c45dd0adc1/cmd/argocd/commands/admin/cluster.go#L555

generate-spec is using a fake client to generate the spec and I think that as part of the generation process, the argocd-cd configmap is attempted to be checked. Since a fake client is getting used, I believe that is the reason its returning "not found".

Not sure how to fix this though.

SayakMukhopadhyay avatar Apr 24 '23 14:04 SayakMukhopadhyay

still the issue is exist ! :(

marvinlnnx avatar Dec 24 '23 01:12 marvinlnnx