Namespaces Generator that discovers namespaces in a target cluster.
It can be used as ArgoCD ApplicationSet plugin https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators-Plugin/.
It can discover existing namespaces in the cluster to produce an app per each namespace.
- You are using JWT authentication to your clusters (i.e. Downward API tokens mounted to pods)
- If using external clusters, you must populate cluster annotation with its Certificate Authority
go run ./... -v=4 --log-format=json server --local
curl -X POST -H "Content-Type: application/json" -d @testdata/request.json http://localhost:8080/api/v1/getparams.execute
-
Access the ArgoCD GUI.
argocd admin dashboard -n argocd
-
Open the browser http://localhost:8080/
-
Deploy the argocd-applicationset-namespaces-generator-plugin Deployment.
kubectl apply -f testdata/manifest.yaml
-
Deploy the ApplicationSet YAMLs.
kubectl apply -f testdata/appset-project-hsiaoairplane-namespaces-rbac.yaml kubectl apply -f testdata/appset-project-airplanehsiao-namespaces-rbac.yaml kubectl apply -f testdata/appset-projects-namespaces-rbac.yaml
-
Create ArgoCD ApplicationProjects.
argocd proj create project-hsiaoairplane -s "*" --dest "*,*" --allow-namespaced-resource "rbac.authorization.k8s.io/Role" --allow-namespaced-resource "rbac.authorization.k8s.io/RoleBinding" --allow-namespaced-resource "*/ServiceAccount" --upsert argocd proj create project-airplanehsiao -s "*" --dest "*,*" --allow-namespaced-resource "rbac.authorization.k8s.io/Role" --allow-namespaced-resource "rbac.authorization.k8s.io/RoleBinding" --allow-namespaced-resource "*/ServiceAccount" --upsert argocd proj create projects -s "*" --dest "*,*" --allow-namespaced-resource "rbac.authorization.k8s.io/Role" --allow-namespaced-resource "rbac.authorization.k8s.io/RoleBinding" --allow-namespaced-resource "*/ServiceAccount" --upsert
-
Create the project "hsiaoairplane" namespaces.
kubectl create namespace foo kubectl label namespace foo project=hsiaoairplane --overwrite=true kubectl create namespace foobar kubectl label namespace foobar project=hsiaoairplane --overwrite=true kubectl create namespace hsiaoairplane kubectl label namespace hsiaoairplane project=hsiaoairplane --overwrite=true
-
Create the project "airplanehsiao" namespaces.
kubectl create namespace bar kubectl label namespace bar project=airplanehsiao --overwrite=true kubectl create namespace barfoo kubectl label namespace barfoo project=airplanehsiao --overwrite=true kubectl create namespace airplanehsiao kubectl label namespace airplanehsiao project=airplanehsiao --overwrite=true