Skip to content

Commit

Permalink
Also wait for all the job pods to be completed.
Browse files Browse the repository at this point in the history
  • Loading branch information
chizhg committed Sep 18, 2020
1 parent e5e518b commit 27fc8c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,18 @@ function wait_until_object_does_not_exist() {
function wait_until_pods_running() {
echo "Waiting until all pods in namespace $1 are up"
kubectl wait pod --for=condition=Ready -n "$1" -l '!job-name' --timeout=5m || return 1
# Also wait for all the job pods to be completed.
# This is mainly for maintaining backward compatibility.
if [[ $(kubectl get jobs --ignore-not-found=true -n "$1") ]]; then
kubectl wait job --for=condition=Complete --all -n "$1" --timeout=5m || return 1
fi
}

# Waits until all batch jobs complete in the given namespace.
# Parameters: $1 - namespace.
function wait_until_batch_job_complete() {
echo "Waiting until all batch jobs in namespace $1 run to completion."
kubectl wait job --for=condition=Complete --all -n "$1" || return 1
kubectl wait job --for=condition=Complete --all -n "$1" --timeout=5m || return 1
}

# Waits until the given service has an external address (IP/hostname).
Expand Down

0 comments on commit 27fc8c0

Please sign in to comment.