zdt-argocd/argocd-repo-server-wrapper.sh
Stefan Reimer e87f9d1a7a
All checks were successful
ZeroDownTime/zdt-argocd/pipeline/head This commit looks good
ZeroDownTime/zdt-argocd/pipeline/tag This commit looks good
feat: integrate kubectl config script into repo-server wrapper
2025-04-09 22:25:52 +00:00

32 lines
678 B
Bash
Executable File

#!/bin/sh
KUBECONFIG=/tmp/kubectl.config
SA_NAME=argo-argocd-repo-server
CA64=$(cat /run/secrets/kubernetes.io/serviceaccount/ca.crt | base64 -w0)
TOKEN=$(cat /run/secrets/kubernetes.io/serviceaccount/token)
cat > $KUBECONFIG << EOF
apiVersion: v1
kind: Config
clusters:
- name: local
cluster:
server: https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT_HTTPS
certificate-authority-data: $CA64
users:
- name: $SA_NAME
user:
token: "$TOKEN"
contexts:
- name: ${SA_NAME}_context
context:
cluster: local
user: $SA_NAME
current-context: ${SA_NAME}_context
EOF
chmod 600 $KUBECONFIG
ARGOCD_BINARY_NAME=argocd-repo-server /usr/local/bin/argocd $@