Files
manifests/vcluster/create-vcluster.sh
T
2024-04-20 19:01:06 +02:00

33 lines
937 B
Bash
Executable File

#!/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
ns=$name-vcluster
shift
kubectl oidc-login get-token \
--oidc-issuer-url=https://login.microsoftonline.com/3f737008-e9a0-4485-9d27-40329d288089/v2.0 \
--oidc-client-id=9b6daef0-02fa-4574-8949-f7c1b5fccd15 \
--oidc-client-secret=o~N8Q~0IvCN05RTohzpYI4yEJ815eKfnzkd9LbUt | jq .status.token > chart/_token
$k get ns $ns >/dev/null 2>&1 || $k create ns $ns
helm template -n $ns $@ $name ./chart | $k apply -f -
$k wait -n $ns --for=condition=ready pod -l app=vcluster
kubectl --context $name-vcluster -n dapr-system wait pod --for=condition=ready -l app=dapr-operator
sleep 10
kubectl kustomize ../resources/atlantis/manifests/staging | kubectl --context $name-vcluster apply -f-