infctl-cli/vagrant/dev/ubuntu/scripts/wait_for_longhorn.sh

18 lines
475 B
Bash
Raw Normal View History

#!/usr/bin/env bash
echo
echo "wait for longhorn installation"
echo
ssh-add ~/.ssh/vm*_key
source /home/vagrant/ansible/venv/bin/activate
while true; do
not_ready=$(kubectl -n longhorn-system get pods --no-headers 2>/dev/null | grep -vE 'Running|Completed' | wc -l)
total=$(kubectl -n longhorn-system get pods --no-headers 2>/dev/null | wc -l)
if [[ $total -gt 0 && $not_ready -eq 0 ]]; then
echo "All Longhorn pods are ready."
break
fi
sleep 10
done