This is a Kubernetes Operator (Crossplane provider) that creates API tokens for specific ArgoCD users.
The provider that is built from the source code in this repository adds the following new functionality:
- a Custom Resource Definition (CRD) that model ArgoCD auth tokens for specific users
With Crossplane and ArgoCD installed in your cluster:
$ helm repo add crossplane-stable https://charts.crossplane.io/stable
$ helm repo update
$ helm install crossplane --namespace crossplane-system crossplane-stable/crossplane
$ kubectl create namespace argo-system
$ kubectl apply -n argo-system -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
$ kubectl apply -f ./examples/provider.yaml
Replace VERSION
tag with the desired release.
$ cat <<EOF | kubectl apply -f -
apiVersion: argocd.krateoplatformops.io/v1alpha1
kind: ProviderConfig
metadata:
name: provider-argocd-token-config
spec:
serverUrl: https://argocd-server.argo-system.svc:443
credentials:
source: Secret
secretRef:
namespace: argo-system
name: argocd-initial-admin-secret
key: password
EOF
Following the steps in the official ArgoCD documentation you can create a new user defining it in the argo-cm
ConfigMap:
$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argo-system
labels:
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
data:
accounts.krateo-dashboard: apiKey, login
EOF
Each user might have two capabilities:
- apiKey: allows generating authentication tokens for API access
- login: allows to login using UI
$ cat <<EOF | kubectl apply -f -
apiVersion: argocd.krateoplatformops.io/v1alpha1
kind: Token
metadata:
name: krateo-dashboard-argocd-token
spec:
forProvider:
account: krateo-dashboard
writeTokenSecretToRef:
name: krateo-dashboard-argocd-token
key: authToken
namespace: krateo-system
providerConfigRef:
name: provider-argocd-token-config
EOF
$ kubectl get secrets/krateo-dashboard-argocd-token -n krateo-system \
--template='{{.data.authToken | base64decode}}'
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkOWZkNDJiYi05ZGU4LTRmMGUtYTA...
This is a community driven project and we welcome contributions.
For filing bugs, suggesting improvements, or requesting new features, please open an issue.