Skip to content

Commit f082bab

Browse files
authored
Improve wait mechanism for hazelcast (#203)
1 parent daef981 commit f082bab

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

scripts/deploy-community-operator.sh

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,18 @@ oc patch installplan \
7474
grep "$COMMUNITY_OPERATOR_NAME" |
7575
cut -f 1 -d \ \
7676
)" || { printf >&2 'Unable to approve the installation plan.\n'; exit 1;}
77-
CSV_CHECK_RETRIES=24 # 240 seconds
78-
while [[ $(oc get csv -n "$TNF_EXAMPLE_CNF_NAMESPACE" "$COMMUNITY_OPERATOR_NAME" -o go-template="{{.status.phase}}") != "Succeeded" && "$CSV_CHECK_RETRIES" -gt 0 ]]; do
79-
echo "waiting for $COMMUNITY_OPERATOR_NAME installation to succeed"
80-
sleep 10
81-
CSV_CHECK_RETRIES=$(($CSV_CHECK_RETRIES-1))
82-
oc get pods -n "$TNF_EXAMPLE_CNF_NAMESPACE"
83-
oc get sa -n "$TNF_EXAMPLE_CNF_NAMESPACE"
84-
echo $CSV_CHECK_RETRIES
85-
done
86-
87-
if [ "$CSV_CHECK_RETRIES" -le 0 ]; then
88-
echo "timed out waiting for the operator to succeed"
89-
oc get csv -n "$TNF_EXAMPLE_CNF_NAMESPACE"
77+
sleep 10
78+
oc wait \
79+
--for=jsonpath=\{.status.phase\}=Succeeded \
80+
csv \
81+
--namespace "$TNF_EXAMPLE_CNF_NAMESPACE" \
82+
--selector=operators.coreos.com/hazelcast-platform-operator.tnf \
83+
--timeout=240s || {
84+
printf >&2 'Timed out waiting for the operator to succeed.\n'
85+
oc get csv --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
9086
exit 1
91-
fi
92-
93-
oc get csv -n "$TNF_EXAMPLE_CNF_NAMESPACE"
87+
}
88+
oc get csv --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
9489

9590
# Label the community operator
9691
oc label clusterserviceversions.operators.coreos.com "$COMMUNITY_OPERATOR_NAME" -n "$TNF_EXAMPLE_CNF_NAMESPACE" test-network-function.com/operator=target

0 commit comments

Comments
 (0)