Add debug info when wait-for-pods.sh fails

Sometimes jobs fail due to pending pods and
we need a way to debug this.

This PR adds `kubectl describe po` for pods if
not all pods are ready.

Change-Id: Iefc03bfbd26764feb54789981bdf0072e0536ee5
This commit is contained in:
Vladimir Kozhukalov 2023-02-01 23:23:14 +03:00
parent 056655d1cd
commit 1f222fc438

View File

@ -42,8 +42,13 @@ while true; do
echo "Some pods are in pending state:"
kubectl get pods --field-selector=status.phase=Pending -n $1 -o wide
fi
[ $READY == "False" ] && echo "Some pods are not ready"
[ $JOBR == "False" ] && echo "Some jobs have not succeeded"
echo
echo "=== DEBUG ==="
echo
kubectl get pods -n $1 | tail -n +2 | awk '{print $1}' | while read pname; do kubectl describe po $pname -n $1; echo; done
exit -1
fi
done