From c2238b46a22b304746d0a55a28b8a0b5df921a36 Mon Sep 17 00:00:00 2001 From: Brian Pursley Date: Wed, 3 Aug 2022 17:23:27 -0400 Subject: [PATCH] Change cluster/gce/util to wait for firewall rule creation Add kube::util::wait-for-jobs in create-network() to wait for background firewall rule creation, and if any fail, log a message and exit with the failed job's return code. --- cluster/gce/util.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index cf8f5502dfd..b591f1dc376 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -2429,6 +2429,12 @@ function create-network() { --allow "tcp:3389" & fi fi + + kube::util::wait-for-jobs || { + code=$? + echo -e "${color_red}Failed to create firewall rules.${color_norm}" >&2 + exit $code + } } function expand-default-subnetwork() { @@ -3099,7 +3105,9 @@ function create-nodes-firewall() { # Wait for last batch of jobs kube::util::wait-for-jobs || { - echo -e "${color_red}Some commands failed.${color_norm}" >&2 + code=$? + echo -e "${color_red}Failed to create firewall rule.${color_norm}" >&2 + exit $code } }