Skip to content

Commit

Permalink
add timeout to setup-cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Lamarre <alexandre.lamarre@suse.com>
  • Loading branch information
alexandreLamarre committed Apr 25, 2024
1 parent bb98e08 commit e3c9223
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/scripts/setup-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,29 @@ fi

# waits until all nodes are ready
wait_for_nodes(){
timeout=120
start_time=$(date +%s)
echo "wait until all agents are ready"
while :
do
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ $elapsed_time -ge $timeout ]; then
echo "Timeout reached, exiting..."
exit 1
fi

readyNodes=1
statusList=$(kubectl get nodes --no-headers | awk '{ print $2}')
# shellcheck disable=SC2162
while read status
do
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ $elapsed_time -ge $timeout ]; then
echo "Timeout reached, exiting..."
exit 1
fi
if [ "$status" == "NotReady" ] || [ "$status" == "" ]
then
readyNodes=0
Expand Down

0 comments on commit e3c9223

Please sign in to comment.