argoproj-labs/argocd-autopilot

argocd-autopilot project create results in configmap "argocd-cm" not found

stubbi opened this issue · 1 comments

So I have two clusters, backoffice-eu-central and prod-eu-central (which is also the names of their kubecontexts).

I have bootstrapped the backoffice cluster using

export KUBECONFIG=/.kubeconfig
export GIT_REPO=https://github.com/org/gitops.git
export GIT_TOKEN=ghp_...

kubectl config set-context backoffice-eu-central
argocd-autopilot repo bootstrap --app https://github.com/argoproj-labs/argocd-autopilot/manifests/ha

which seems to work fine. Now, I'd want that argocd to manage my other cluster as well with overlays in some /prod (or similar) folders. So in orders to add that cluster, I am running

export KUBECONFIG=/.kubeconfig
export GIT_REPO=https://github.com/org/gitops.git
export GIT_TOKEN=ghp_...
export NAME=prod-eu-central

kubectl config set-context backoffice-eu-central
argocd-autopilot project create $NAME --dest-kube-context $NAME --insecure --log-level=debug --core -y

and get

DEBU[2023-03-08T02:28:11+01:00] starting with options:                        forWrite=true repoURL="https://github.com/org/gitops.git" revision=
INFO[2023-03-08T02:28:11+01:00] cloning git repository: https://github.com/org/gitops.git
DEBU[2023-03-08T02:28:11+01:00] cloning git repo                              url="https://github.com/org/gitops.git"
Enumerating objects: 18, done.
Counting objects: 100% (18/18), done.
Compressing objects: 100% (13/13), done.
Total 18 (delta 1), reused 16 (delta 1), pack-reused 0
INFO[2023-03-08T02:28:12+01:00] using revision: "", installation path: "/"
DEBU[2023-03-08T02:28:12+01:00] repository is ok
DEBU[2023-03-08T02:28:12+01:00] repository is ok
INFO[2023-03-08T02:28:12+01:00] adding cluster: prod-eu-central
INFO[0001] ServiceAccount "argocd-manager" already exists in namespace "kube-system"
INFO[0001] ClusterRole "argocd-manager-role" updated
INFO[0001] ClusterRoleBinding "argocd-manager-role-binding" updated
FATA[0001] configmap "argocd-cm" not found

I can confirm the argocd-cm is in the original backoffice cluster, but not so in the other prod one I am trying to add here. I can confirm that one has the service account, clusterrole, and clusterrolebinding mentioned in that output.

What am I missing?

Apparently, I found the solution. I had to specify the namespace when setting the context

So, this is working:

set -e

kubectl config set-context backoffice-eu-central --namespace=argocd 1> /dev/null
argocd-autopilot project create $NAME --upsert --dest-kube-context $NAME --insecure --log-level=debug --core -y

note the --namespace=argocd