Merge "Gate: avoid failing before Nodes are defined"

This commit is contained in:
Zuul 2020-08-10 16:16:23 +00:00 committed by Gerrit Code Review
commit 46215ceaf7

View File

@ -78,30 +78,27 @@ echo ${KUBECONFIG} | base64 -d > /tmp/targetkubeconfig
echo "Import target kubeconfig" echo "Import target kubeconfig"
airshipctl config import /tmp/targetkubeconfig airshipctl config import /tmp/targetkubeconfig
echo "Check kubectl version" echo "Wait for apiserver to become available"
VERSION=""
N=0 N=0
MAX_RETRY=30 MAX_RETRY=30
DELAY=60 DELAY=60
until [ "$N" -ge ${MAX_RETRY} ] until [ "$N" -ge ${MAX_RETRY} ]
do do
VERSION=$(timeout 20 kubectl --kubeconfig /tmp/targetkubeconfig version | grep 'Server Version' || true) if timeout 20 kubectl --kubeconfig /tmp/targetkubeconfig get node; then
if [[ ! -z "$VERSION" ]]; then
break break
fi fi
N=$((N+1)) N=$((N+1))
echo "$N: Retry to get kubectl version." echo "$N: Retrying to reach the apiserver"
sleep ${DELAY} sleep ${DELAY}
done done
if [[ -z "$VERSION" ]]; then if [ "$N" -ge ${MAX_RETRY} ]; then
echo "Could not get kubectl version." echo "Could not reach the apiserver"
exit 1 exit 1
fi fi
echo "Check nodes status" echo "Wait for nodes to become Ready"
kubectl --kubeconfig /tmp/targetkubeconfig wait --for=condition=Ready node --all --timeout 900s kubectl --kubeconfig /tmp/targetkubeconfig wait --for=condition=Ready node --all --timeout 900s
echo "Get cluster state" echo "Get cluster state"