Skip to content

Commit

Permalink
Cleanup timeout messaging, lower job start timeout to 5 minutes
Browse files Browse the repository at this point in the history
I misunderstood the bash logic when I first extended that to one
hour. 5 minutes for an agent download is somewhat more sensible.
  • Loading branch information
nflynt committed Aug 10, 2023
1 parent 4e18baa commit 9a71e38
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cleanup/ad-guid-unmigration.sh
Expand Up @@ -108,9 +108,6 @@ rules:
EOF
)

# 7200 is equal to one hour as the sleep is half a second
timeout=7200

# Agent image to use in the yaml file
agent_image="$1"

Expand Down Expand Up @@ -205,12 +202,18 @@ 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}")

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

declare -i count=0
until kubectl --namespace=cattle-system logs $pod_id -f
do
if [ $count -gt $timeout ]
if [ $count -gt $job_start_timeout ]
then
echo "Timout reached, check the job by running kubectl get jobs"
echo "Timout reached, check the job by running kubectl --namespace=cattle-system get jobs"
echo "To cleanup manually, you can run:"
echo " kubectl --namespace=cattle-system delete serviceaccount,job -l rancher-cleanup=true"
echo " kubectl delete clusterrole,clusterrolebinding -l rancher-cleanup=true"
exit 1
fi
sleep 0.5
Expand Down

0 comments on commit 9a71e38

Please sign in to comment.