From 0f60aba7c1d214a597e464345f37ef7ede7394be Mon Sep 17 00:00:00 2001 From: Jerzy Szczepkowski Date: Tue, 13 Dec 2016 14:13:44 +0100 Subject: [PATCH] Fixed validation of multizone cluster for GCE. Fixed validation of multizone cluster for GCE: taking actual number of worker nodes. --- cluster/validate-cluster.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cluster/validate-cluster.sh b/cluster/validate-cluster.sh index d3727a5bb69..d5efaf31b06 100755 --- a/cluster/validate-cluster.sh +++ b/cluster/validate-cluster.sh @@ -51,6 +51,15 @@ ALLOWED_NOTREADY_NODES="${ALLOWED_NOTREADY_NODES:-0}" CLUSTER_READY_ADDITIONAL_TIME_SECONDS="${CLUSTER_READY_ADDITIONAL_TIME_SECONDS:-30}" EXPECTED_NUM_NODES="${NUM_NODES}" + +if [[ "${KUBERNETES_PROVIDER:-}" == "gce" ]]; then + # In multizone mode we need to add instances for all nodes in the region. + if [[ "${MULTIZONE:-}" == "true" ]]; then + EXPECTED_NUM_NODES=$(gcloud compute instances list --format=[no-heading] --regexp="${NODE_INSTANCE_PREFIX}.*" \ + --zones=$(gcloud compute zones list --filter=region=europe-west1 --format=[no-heading]\(name\) | tr "\n" "," | sed "s/,$//") | wc -l) + fi +fi + if [[ "${REGISTER_MASTER_KUBELET:-}" == "true" ]]; then if [[ "${KUBERNETES_PROVIDER:-}" == "gce" ]]; then NUM_MASTERS=$(get-master-replicas-count) @@ -59,6 +68,7 @@ if [[ "${REGISTER_MASTER_KUBELET:-}" == "true" ]]; then fi EXPECTED_NUM_NODES=$((EXPECTED_NUM_NODES+NUM_MASTERS)) fi + REQUIRED_NUM_NODES=$((EXPECTED_NUM_NODES - ALLOWED_NOTREADY_NODES)) # Make several attempts to deal with slow cluster birth. return_value=0