Skip to content

Instantly share code, notes, and snippets.

@tdshipley
Created June 5, 2019 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdshipley/a9fcafe9e8c3899b94328e8894f76afb to your computer and use it in GitHub Desktop.
Save tdshipley/a9fcafe9e8c3899b94328e8894f76afb to your computer and use it in GitHub Desktop.
Script to find a running pod for a job in GCP K8s Engine
tryCount=0
runningPod=""
while [ "$runningPod" == "" ] && [ $tryCount -lt 12 ]
do
tryCount=$((tryCount + 1))
echo "Searching for pod... try $tryCount of 12"
sleep 5
runningPod="$(kubectl get pods --selector=job-name=$jobName --output=jsonpath={.items..metadata.name})"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment