Skip to content

Commit 9c46f41

Browse files
fix(orchestrator): query by CSV name prefix instead of displayName for stability
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
1 parent 112d36b commit 9c46f41

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/deployment/orchestrator/install-orchestrator.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,19 @@ EOD
123123
}
124124

125125
check_operator_status() {
126-
local timeout=${1:-300} namespace=$2 operator_name=$3 expected_status=${4:-Succeeded}
127-
log::info "Checking operator '${operator_name}' in '${namespace}' (timeout ${timeout}s, expected: ${expected_status})"
126+
local timeout=${1:-300} namespace=$2 csv_name_prefix=$3 expected_status=${4:-Succeeded}
127+
log::info "Checking operator CSV '${csv_name_prefix}*' in '${namespace}' (timeout ${timeout}s, expected: ${expected_status})"
128128
timeout "${timeout}" bash -c "
129129
while true; do
130-
CURRENT_PHASE=\$(oc get csv -n '${namespace}' -o jsonpath='{.items[?(@.spec.displayName==\"${operator_name}\")].status.phase}')
131-
echo \"[check_operator_status] Phase: \${CURRENT_PHASE}\" >&2
130+
CSV_NAME=\$(oc get csv -n '${namespace}' -o name 2>/dev/null | grep \"/${csv_name_prefix}\" | head -1 | cut -d'/' -f2)
131+
if [[ -n \"\${CSV_NAME}\" ]]; then
132+
CURRENT_PHASE=\$(oc get csv \"\${CSV_NAME}\" -n '${namespace}' -o jsonpath='{.status.phase}' 2>/dev/null)
133+
else
134+
CURRENT_PHASE=\"\"
135+
fi
136+
echo \"[check_operator_status] CSV: \${CSV_NAME}, Phase: \${CURRENT_PHASE}\" >&2
132137
[[ \"\${CURRENT_PHASE}\" == \"${expected_status}\" ]] && echo \"[check_operator_status] Operator reached ${expected_status}\" >&2 && break
138+
[[ -z \"\${CSV_NAME}\" ]] && echo \"[check_operator_status] No CSV found matching '${csv_name_prefix}'\" >&2
133139
sleep 10
134140
done
135141
" || { log::error "Operator did not reach ${expected_status} in time."; return 1; }
@@ -140,7 +146,7 @@ install_serverless_logic_ocp_operator() {
140146
return 0
141147
}
142148
waitfor_serverless_logic_ocp_operator() {
143-
check_operator_status 500 openshift-operators "Red Hat OpenShift Serverless Logic" Succeeded
149+
check_operator_status 500 openshift-operators "logic-operator" Succeeded
144150
return 0
145151
}
146152

@@ -149,7 +155,7 @@ install_serverless_ocp_operator() {
149155
return 0
150156
}
151157
waitfor_serverless_ocp_operator() {
152-
check_operator_status 300 openshift-operators "Red Hat OpenShift Serverless" Succeeded
158+
check_operator_status 300 openshift-operators "serverless-operator" Succeeded
153159
return 0
154160
}
155161

0 commit comments

Comments
 (0)