feat: add script to update argo vcluster connection tokens

This commit is contained in:
Jonas Juselius
2024-04-20 08:19:42 +02:00
parent 3b44b6040f
commit c96a86a141
2 changed files with 34 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
if [ ! $# -ge 1 ]; then
echo "usage: $0 cluster [helm args]"
exit 1
fi
if [ ! -d chart ]; then
echo "error: must be run from toplevel directory"
exit 1
fi
k='kubectl --context oceanbox'
name=$1
cluster=$name-vcluster
shift
token=$(kubectl get secret --context $cluster -n kube-system admin-token -o json | jq .data.token | tr -d '"')
config=$(echo "{\"bearerToken\": \"$token\", \"tlsClientConfig\": { \"insecure\" : true }}" | base64 -w0)
$k patch -n argocd secret cluster-$cluster -p "{\"data\":{\"config\":\"$config\"}}"