From 7cc59bc6abe2f1e9d933c22109b188aff6029c33 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 5 Dec 2018 23:42:40 -0800 Subject: [PATCH] ci-operator/templates/openshift-ansible: Refactor router-rollout wait Catch up with ac206e7a (ci-operator/templates/openshift: Refactor router-rollout wait (again), 2018-11-05, #2342) and ff16a015 (ci-operator/templates/openshift: Refactor router-rollout 'oc oc', 2018-12-09, #2343). --- .../cluster-launch-e2e-40.yaml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ci-operator/templates/openshift/openshift-ansible/cluster-launch-e2e-40.yaml b/ci-operator/templates/openshift/openshift-ansible/cluster-launch-e2e-40.yaml index f89111ca41865..936815bc920b0 100644 --- a/ci-operator/templates/openshift/openshift-ansible/cluster-launch-e2e-40.yaml +++ b/ci-operator/templates/openshift/openshift-ansible/cluster-launch-e2e-40.yaml @@ -157,16 +157,17 @@ objects: break done - i=0 - MAX_RETRIES=10 - wait_expiry_ts="$(($(date +%s) + 90))" - until oc --request-timeout=80s rollout status "${ROUTER_DEPLOYMENT}" -n "${ROUTER_NAMESPACE}" -w; do - i=$((i+1)) - [ $i -eq $MAX_RETRIES ] && echo "timeout waiting for ${ROUTER_NAMESPACE}/${ROUTER_DEPLOYMENT} to be available" && exit 1 - echo "error ${ROUTER_NAMESPACE}/${ROUTER_DEPLOYMENT} did not come up" - sleep "$((wait_expiry_ts - $(date +%s)))" - wait_expiry_ts="$(($(date +%s) + 90))" + TARGET="$(date -d '10 minutes' +%s)" + NOW="$(date +%s)" + while [[ "${NOW}" -lt "${TARGET}" ]]; do + REMAINING="$((TARGET - NOW))" + if oc --request-timeout="${REMAINING}s" rollout status "${ROUTER_DEPLOYMENT}" -n "${ROUTER_NAMESPACE}" -w; then + break + fi + sleep 2 + NOW="$(date +%s)" done + [[ "${NOW}" -ge "${TARGET}" ]] && echo "timeout waiting for ${ROUTER_NAMESPACE}/${ROUTER_DEPLOYMENT} to be available" && exit 1 # set up cloud-provider-specific env vars if [[ "${CLUSTER_TYPE}" == "gcp" ]]; then