From 565f374927a2104fec8ec39b06f93080bc198cb0 Mon Sep 17 00:00:00 2001 From: Dan Prince <dprince@redhat.com> Date: Thu, 19 Dec 2024 11:52:23 -0500 Subject: [PATCH] Check for running replicas for get-operator-status.sh We are eliminating CSV's for service operators when using openstack-operator. As such in order to check that all operators are running we should can check for replicas for the controller-manager deployments --- scripts/get-operator-status.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/scripts/get-operator-status.sh b/scripts/get-operator-status.sh index 3a3bf56..3d641e5 100644 --- a/scripts/get-operator-status.sh +++ b/scripts/get-operator-status.sh @@ -9,15 +9,9 @@ if [ -z "$OPERATOR_NAME" ]; then echo "Please set OPERATOR_NAME"; exit 1 fi -CSVNAME=$(oc get csv -n ${OPERATOR_NAMESPACE} -o jsonpath='{range .items[*]}{@.metadata.name}{"\n"}{end}' | grep -E "^${OPERATOR_NAME}-operator\.v") -if [ -z "$CSVNAME" ]; then - echo "NOTFOUND" - exit 1 -fi - -PHASE=$(oc get -n ${OPERATOR_NAMESPACE} csv/${CSVNAME} -o jsonpath='{.status.phase}') -echo $PHASE -if [ "$PHASE" != "Succeeded" ]; then +REPLICAS=$(oc get -n "${OPERATOR_NAMESPACE}" deployment ${OPERATOR_NAME}-operator-controller-manager -o json | jq -e '.status.availableReplicas') +if [ "$REPLICAS" != "1" ]; then exit 1 fi +echo "Succeeded" exit 0