Skip to content

Commit

Permalink
Give the job pod a chance to come up before tailing the log
Browse files Browse the repository at this point in the history
  • Loading branch information
crobby committed Aug 16, 2023
1 parent df0307e commit 12020af
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cleanup/ad-guid-unmigration.sh
Expand Up @@ -229,7 +229,19 @@ fi
echo "$yaml" | kubectl apply -f -

# Get the pod ID to tail the logs
pod_id=$(kubectl --namespace=cattle-system get pod -l job-name=cattle-cleanup-job -o jsonpath="{.items[0].metadata.name}")
retry_interval=1
max_retries=10
retry_count=0
pod_id=""
while [ $retry_count -lt $max_retries ]; do
pod_id=$(kubectl --namespace=cattle-system get pod -l job-name=cattle-cleanup-job -o jsonpath="{.items[0].metadata.name}")
if [ -n "$pod_id" ]; then
break
else
sleep $retry_interval
((retry_count++))
fi
done

# 600 is equal to 5 minutes, because the sleep interval is 0.5 seconds
job_start_timeout=600
Expand Down

0 comments on commit 12020af

Please sign in to comment.