From 9a7c793df638af4d79914408bda92bcb82b541cc Mon Sep 17 00:00:00 2001 From: xilabao Date: Fri, 28 Oct 2016 14:42:07 +0800 Subject: [PATCH] break endless loop in cluser/vagrant/util.sh --- cluster/vagrant/util.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cluster/vagrant/util.sh b/cluster/vagrant/util.sh index dddedcf04e6..ca1274ecb7c 100755 --- a/cluster/vagrant/util.sh +++ b/cluster/vagrant/util.sh @@ -241,7 +241,14 @@ function verify-cluster { echo "Waiting for each node to be registered with cloud provider" for (( i=0; i<${#NODE_NAMES[@]}; i++)); do local validated="0" + start="$(date +%s)" until [[ "$validated" == "1" ]]; do + now="$(date +%s)" + # Timeout set to 3 minutes + if [ $((now - start)) -gt 180 ]; then + echo "Timeout while waiting for echo node to be registered with cloud provider" + exit 2 + fi local nodes=$("${KUBE_ROOT}/cluster/kubectl.sh" get nodes -o name --api-version=v1) validated=$(echo $nodes | grep -c "${NODE_NAMES[i]}") || { printf "."