diff --git a/scripts/deploy/github/helper-functions.sh b/scripts/deploy/github/helper-functions.sh index 7017d5c8b1d..0b3933ed891 100644 --- a/scripts/deploy/github/helper-functions.sh +++ b/scripts/deploy/github/helper-functions.sh @@ -71,22 +71,22 @@ wait_for_pods () { while [[ $i -lt $max_retries ]] do local pods - local statuses + local ready_pods local num_pods - local num_running + local num_ready + pods=$(kubectl get pod -n "$namespace" --no-headers 2>/dev/null) if [[ -z $pods ]]; then echo "No pods found or error retrieving pods." else - statuses=$(echo "$pods" | awk '{print $3}') - num_pods=$(echo "$statuses" | wc -l | xargs) - num_running=$(echo "$statuses" | grep -cE 'Running|Completed') + ready_pods=$(echo "$pods" | awk '$2 == $3 {print $0}') + num_pods=$(echo "$pods" | wc -l | xargs) + num_ready=$(echo "$ready_pods" | wc -l | xargs) - local msg="${num_running}/${num_pods} pods running in \"${namespace}\"." + local msg="${num_ready}/${num_pods} pods are ready in \"${namespace}\"." - if [[ $num_running -ne $num_pods ]] - then + if [[ $num_ready -ne $num_pods ]]; then # for debugging # kubectl get pod -n "$namespace" | grep '0/1' | awk '{print $1}' | xargs kubectl describe pod -n "$namespace" echo "$msg Checking again in ${sleep_time}s."