Files
open-cluster-management/solutions/setup-dev-environment/local-up.sh
Anurag Nayak e4eff8b384
Some checks are pending
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
docs: Made some typo fixes in the setup script (#883)
Signed-off-by: Anu-Ra-g <nayakanurag078@gmail.com>
2025-03-11 09:37:31 +00:00

33 lines
916 B
Bash
Executable File

#!/bin/bash
cd $(dirname ${BASH_SOURCE})
set -e
hub=${CLUSTER1:-hub}
c1=${CLUSTER1:-cluster1}
c2=${CLUSTER2:-cluster2}
hubctx="kind-${hub}"
c1ctx="kind-${c1}"
c2ctx="kind-${c2}"
kind create cluster --name "${hub}"
kind create cluster --name "${c1}"
kind create cluster --name "${c2}"
echo -e "Initialize the ocm hub cluster\n"
clusteradm init --wait --context ${hubctx}
joincmd=$(clusteradm get token --context ${hubctx} | grep clusteradm)
echo -e "Join cluster1 to hub\n"
$(echo ${joincmd} --force-internal-endpoint-lookup --wait --context ${c1ctx} | sed "s/<cluster_name>/$c1/g")
echo -e "Join cluster2 to hub\n"
$(echo ${joincmd} --force-internal-endpoint-lookup --wait --context ${c2ctx} | sed "s/<cluster_name>/$c2/g")
echo -e "Accept join of cluster1 and cluster2\n"
clusteradm accept --context ${hubctx} --clusters ${c1},${c2} --wait
kubectl get managedclusters --all-namespaces --context ${hubctx}