Skip to content

Commit

Permalink
Check for running replicas for get-operator-status.sh
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dprince committed Dec 19, 2024
1 parent 11e411a commit 565f374
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions scripts/get-operator-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 565f374

Please sign in to comment.