theshire/.taskfiles/volsync/resources/wait-for-job.sh

15 lines
365 B
Bash
Raw Normal View History

2024-07-08 10:53:12 -05:00
#!/usr/bin/env bash
JOB=$1
NAMESPACE="${2:-default}"
CLUSTER="${3:-main}"
2024-07-08 10:53:12 -05:00
[[ -z "${JOB}" ]] && echo "Job name not specified" && exit 1
while true; do
STATUS="$(kubectl --context "${CLUSTER}" -n "${NAMESPACE}" get pod -l job-name="${JOB}" -o jsonpath='{.items[*].status.phase}')"
if [ "${STATUS}" == "Pending" ]; then
break
fi
sleep 1
done