From cc7ecea136b2f51ec9f8ba1bfe8987f00a8ffe1a Mon Sep 17 00:00:00 2001 From: Eran Ifrach Date: Sun, 29 Sep 2024 12:43:37 +0300 Subject: [PATCH] MGMT-18628: fix better waiting for deployment --- deploy/operator/utils.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deploy/operator/utils.sh b/deploy/operator/utils.sh index 2a783525d58..d4e7e741103 100644 --- a/deploy/operator/utils.sh +++ b/deploy/operator/utils.sh @@ -72,9 +72,16 @@ function wait_for_deployment() { for i in {1..40}; do oc get deployment "${deployment}" --namespace="${namespace}" |& grep -ivE "(no resources found|not found)" && break || sleep 10 done + if $i -eq 40; than + echo "ERROR: failed Waiting for (deployment) on namespace (${namespace}) with name (${deployment}) to be created..." + exit 1 + fi + echo "Waiting for (deployment) on namespace (${namespace}) with name (${deployment}) to rollout..." - oc rollout status "deploy/${deployment}" -n "${namespace}" --timeout="${timeout}" + REPLICAS=$(oc get deployments.apps -n assisted-installer assisted-service -o json | jq .status.replicas) + oc "${namespace}" wait --for=jsonpath='{.status.availableReplicas}'=$REPLICAS \ + --timeout=5m "deployment.apps/${deployment}" } function hash() {