From fe24e8b2670b9008ff39e934a07c6eb8a60c12a4 Mon Sep 17 00:00:00 2001 From: Abhinav Dahiya Date: Mon, 1 Oct 2018 13:30:39 -0700 Subject: [PATCH] templates: add retry on oc wait command --- .../cluster-launch-installer-e2e.yaml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/ci-operator/templates/cluster-launch-installer-e2e.yaml b/ci-operator/templates/cluster-launch-installer-e2e.yaml index eceaac03b4f85..8d63916fcbf1e 100644 --- a/ci-operator/templates/cluster-launch-installer-e2e.yaml +++ b/ci-operator/templates/cluster-launch-installer-e2e.yaml @@ -144,17 +144,14 @@ objects: break done - if ! oc wait deploy/router -n "${ROUTER_NAMESPACE}" --for condition=available --timeout=10m; then - # BUG: wait is exiting with an error that implies the structure of the object is not correct from - # the server - add more debugging info here until we know why - echo "error: Deployment did not come up" - oc get deploy/router -o yaml || true - sleep 30 - if ! oc wait deploy/router -n "${ROUTER_NAMESPACE}" --for condition=available --timeout=5m; then - echo "Installation failed" - exit 1 - fi - fi + i=0 + MAX_RETRIES=10 + until oc wait deploy/router -n "${ROUTER_NAMESPACE}" --for condition=available --timeout=10m || [ $i -eq $MAX_RETRIES ]; do + i=$((i+1)) + [ $i -eq $MAX_RETRIES ] && echo "timeout waiting for router to be available" && exit 1 + echo "error deploy/router did not come up" + sleep 60 + done # set up cloud-provider-specific env vars if [[ "${CLUSTER_TYPE}" == "gcp" ]]; then