Skip to content

Commit

Permalink
Move wait for pods to be started to start-k8s script
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishad-M-I-M committed May 18, 2024
1 parent 582ca89 commit 52bf1d2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
24 changes: 24 additions & 0 deletions start-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,30 @@ no_of_workers="${NO_OF_WORKERS}" \
enable_nmon="${ENABLE_NMON}" \
envsubst <"./k8s/master-deployment.yaml" | kubectl apply -f -

# Wait till all pods are running
cur_timestamp="$(date +%s)"
end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"
while true; do
if [ "$(date +%s)" -gt "$end_timestamp" ]; then
echo "Pods are not running"
exit 1
fi

set +e
pods_status="$(kubectl get pods | grep -v 'STATUS' | grep -v 'Running')"
set -e
if [ -z "$pods_status" ]; then
echo "All pods are running"
break
fi

echo "----------------------------------------"
echo "Waiting for pods to be running"
echo "----------------------------------------"
echo "$pods_status"
sleep 5
done

# wait until master starts listening
cur_timestamp="$(date +%s)"
end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"
Expand Down
28 changes: 0 additions & 28 deletions test-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,6 @@ cp -r env_init env
cd "$PROJECT_ROOT"
build_and_run_on_k8s

# Wait till all pods are running
cur_timestamp="$(date +%s)"
end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"
while true; do
if [ "$(date +%s)" -gt "$end_timestamp" ]; then
echo "Pods are not running"
echo "Build log:"
cat "$BUILD_LOG"
echo "Run log:"
cat "$RUN_LOG"
force_remove "${TEST_ROOT}/env"
clear_resources
exit 1
fi

set +e
pods_status="$(kubectl get pods | grep -v 'STATUS' | grep -v 'Running')"
set -e
if [ -z "$pods_status" ]; then
echo "All pods are running"
break
fi

echo "Waiting for pods to be running"
echo "$pods_status"
sleep 5
done

# Wait till JasmineGraph server start listening
cur_timestamp="$(date +%s)"
end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"
Expand Down

0 comments on commit 52bf1d2

Please sign in to comment.