1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-16 09:16:38 +00:00
prometheus-operator/scripts/jenkins/wait-for-cluster.sh
2017-02-23 16:44:00 +01:00

22 lines
499 B
Bash
Executable file

#!/bin/bash
set -e
AMOUNT_NODES=$1
# Wait for kubernetes cluster to become available
until kubectl cluster-info
do
sleep 10
done
function getAmountReadyNodes {
kubectl get nodes -ojson | jq '[.items[].status.conditions[] | select( .type=="Ready" and .status=="True")] | length'
}
# Wait for all nodes to become ready
until [[ $(getAmountReadyNodes) == $AMOUNT_NODES ]]
do
echo "Waiting for nodes to become ready: $(getAmountReadyNodes) / $AMOUNT_NODES are ready."
sleep 10
done