Skip to content

Commit dbc72eb

Browse files
authored
Revert "Revert "capz: use provider-agnostic bastion resolution (#520)"" (#527)
* Revert "Revert "capz: use provider-agnostic bastion resolution (#520)" (#525)" This reverts commit 7e81a08. * fix shellcheck errors Signed-off-by: Mark Rossett <marosset@microsoft.com> --------- Signed-off-by: Mark Rossett <marosset@microsoft.com>
1 parent ddce134 commit dbc72eb

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

capz/run-capz-e2e.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff 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(){
282295
apply_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

0 commit comments

Comments
 (0)