fix: make create cluster more flexible and robust
This commit is contained in:
@@ -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 '"' | base64 -d)
|
||||
config=$(echo "{\"bearerToken\": \"$token\", \"tlsClientConfig\": { \"insecure\" : true }}" | base64 -w0)
|
||||
$k patch -n argocd secret cluster-$cluster -p "{\"data\":{\"config\":\"$config\"}}"
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
vcluster connect $1-vcluster -n $1-vcluster \
|
||||
--context oceanbox \
|
||||
--update-current=true \
|
||||
--kube-config-context-name $1-vcluster \
|
||||
--insecure --cluster-role cluster-admin \
|
||||
--service-account kube-system/admin \
|
||||
--server https://$1-vcluster.beta.oceanbox.io
|
||||
|
||||
Reference in New Issue
Block a user