Skip to content

Commit

Permalink
add timeout to script waiting for the cert-manager-webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
Diaphteiros committed Jul 31, 2020
1 parent 8838004 commit 9a7e900
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions components/cert-manager/controller/action
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,23 @@ webhookready()
return
fi

debug "webhook replicas: $(kubectl -n "$namespace" get deployment cert-manager-webhook -o jsonpath='{.status.readyReplicas}')"
while true; do
replicas=$(kubectl -n "$namespace" get deployment cert-manager-webhook -o jsonpath='{.status.readyReplicas}')
if [[ ${replicas:-0} -gt 0 ]]; then
break
fi
echo "waiting for cert-manager webhook to be running"
sleep 10
done
local starttime
local endtime
local timeout=600
starttime=$(date +%s)
endtime=$(( starttime + timeout ))

if [[ -z "$DRYRUN" ]]; then
debug "webhook replicas: $(kubectl -n "$namespace" get deployment cert-manager-webhook -o jsonpath='{.status.readyReplicas}')"
while [[ $(date +%s) -le $endtime ]]; do
replicas=$(kubectl -n "$namespace" get deployment cert-manager-webhook -o jsonpath='{.status.readyReplicas}')
if [[ ${replicas:-0} -gt 0 ]]; then
return
fi
echo "waiting for cert-manager webhook to be running"
sleep 10
done
fail "cert-manager-webhook did not become ready within $timeout seconds"
fi
fi
}

0 comments on commit 9a7e900

Please sign in to comment.