File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -264,9 +264,22 @@ create_cluster(){
264264 log " cluster creation complete"
265265 fi
266266
267+ log " wait for \" ${CLUSTER_NAME} \" cluster to stabilize"
268+ timeout --foreground 300 bash -c " until kubectl get --raw /version --request-timeout 5s > /dev/null 2>&1; do sleep 3; done"
269+
270+ CLUSTER_JSON=$( kubectl get cluster " ${CLUSTER_NAME} " -n default -o json || true)
271+ if [[ -z " ${CLUSTER_JSON} " ]]; then
272+ log " ERROR: failed to get cluster \" ${CLUSTER_NAME} \" in namespace default"
273+ exit 1
274+ fi
275+ BASTION_ADDRESS=$( echo " ${CLUSTER_JSON} " | jq -r ' .spec.controlPlaneEndpoint.host // empty' )
276+ if [[ -z " ${BASTION_ADDRESS} " ]]; then
277+ log " ERROR: bastion address lookup failed for cluster"
278+ echo " ${CLUSTER_JSON} "
279+ exit 1
280+ fi
267281 # set the SSH bastion that can be used to SSH into nodes
268- KUBE_SSH_BASTION=$( kubectl get azurecluster -o json | jq ' .items[0].spec.networkSpec.apiServerLB.frontendIPs[0].publicIP.dnsName' | tr -d \" ) :22
269- export KUBE_SSH_BASTION
282+ export KUBE_SSH_BASTION=" ${BASTION_ADDRESS} :22"
270283 KUBE_SSH_USER=capi
271284 export KUBE_SSH_USER
272285 log " bastion info: $KUBE_SSH_USER @$KUBE_SSH_BASTION "
@@ -282,7 +295,7 @@ create_cluster(){
282295apply_workload_configuration (){
283296 log " wait for cluster to stabilize"
284297 timeout --foreground 300 bash -c " until kubectl get --raw /version --request-timeout 5s > /dev/null 2>&1; do sleep 3; done"
285-
298+
286299 log " installing calico"
287300 " $TOOLS_BIN_DIR " /helm repo add projectcalico https://docs.tigera.io/calico/charts
288301 kubectl create ns calico-system
You can’t perform that action at this time.
0 commit comments