From 8dc0be6b9ef3c0ae2f5c534f0b482d4a33315fcd Mon Sep 17 00:00:00 2001 From: Krzysztof Siedlecki Date: Tue, 30 Apr 2019 18:42:09 +0200 Subject: [PATCH] creating instance groups in parallel --- cluster/gce/util.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 2eea8085dc2..280b3d1d88f 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -2786,18 +2786,21 @@ function create-linux-nodes() { this_mig_size=$((${instances_left} / (${NUM_MIGS}-${i}+1))) instances_left=$((instances_left-${this_mig_size})) - gcloud compute instance-groups managed \ - create "${group_name}" \ - --project "${PROJECT}" \ - --zone "${ZONE}" \ - --base-instance-name "${group_name}" \ - --size "${this_mig_size}" \ - --template "${template_name}" || true; - gcloud compute instance-groups managed wait-until-stable \ - "${group_name}" \ - --zone "${ZONE}" \ - --project "${PROJECT}" \ - --timeout "${MIG_WAIT_UNTIL_STABLE_TIMEOUT}" || true & + # Run instance-groups creation in parallel. + { + gcloud compute instance-groups managed \ + create "${group_name}" \ + --project "${PROJECT}" \ + --zone "${ZONE}" \ + --base-instance-name "${group_name}" \ + --size "${this_mig_size}" \ + --template "${template_name}" || true; + gcloud compute instance-groups managed wait-until-stable \ + "${group_name}" \ + --zone "${ZONE}" \ + --project "${PROJECT}" \ + --timeout "${MIG_WAIT_UNTIL_STABLE_TIMEOUT}" || true + } & done wait }