diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 35689b86020..8f55e8c4c5a 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -401,12 +401,12 @@ function detect-master() { if [[ -z "${KUBE_MASTER_IP-}" ]]; then local master_address_name="${MASTER_NAME}-ip" echo "Looking for address '${master_address_name}'" >&2 - KUBE_MASTER_IP=$(gcloud compute addresses describe "${master_address_name}" \ - --project "${PROJECT}" --region "${REGION}" -q --format='value(address)') - fi - if [[ -z "${KUBE_MASTER_IP-}" ]]; then - echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" >&2 - exit 1 + if ! KUBE_MASTER_IP=$(gcloud compute addresses describe "${master_address_name}" \ + --project "${PROJECT}" --region "${REGION}" -q --format='value(address)') || \ + [[ -z "${KUBE_MASTER_IP-}" ]]; then + echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" >&2 + exit 1 + fi fi echo "Using master: $KUBE_MASTER (external IP: $KUBE_MASTER_IP)" >&2 }