Skip to content

Commit 22868a6

Browse files
NO-ISSUE: Fix catalogsource when upgrading operator (#2724)
This restructures the existing code and fixes the issue which happens during the installation of the operator in the upgrade scenario. The issue is `catalogsources.operators.coreos.com "assisted-service-operator-catalog not found"` which got introduced during operator upgrade job improvements changes.
1 parent 38d5ad3 commit 22868a6

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

deploy/operator/common.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export ASSISTED_NAMESPACE="${ASSISTED_NAMESPACE:-assisted-installer}"
2121
export SPOKE_NAMESPACE="${SPOKE_NAMESPACE:-assisted-spoke-cluster}"
2222
export HIVE_NAMESPACE="${HIVE_NAMESPACE:-hive}"
2323
export ASSISTED_UPGRADE_OPERATOR="${ASSISTED_UPGRADE_OPERATOR:-false}"
24+
export ASSISTED_SERVICE_OPERATOR_CATALOG="assisted-service-operator-catalog"
2425

2526
############
2627
# Versions #

deploy/operator/gather.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function gather_hive_data() {
1717
}
1818

1919
function gather_olm_data() {
20-
oc get catalogsource assisted-service-operator-catalog -n openshift-marketplace -o yaml > ${LOGS_DEST}/assisted-service-operator-catalog.log
20+
oc get catalogsource "${ASSISTED_SERVICE_OPERATOR_CATALOG}" -n openshift-marketplace -o yaml > ${LOGS_DEST}/${ASSISTED_SERVICE_OPERATOR_CATALOG}.log
2121
oc get subscription assisted-service-operator -n "${ASSISTED_NAMESPACE}" -o yaml > ${LOGS_DEST}/assisted-service-operator-subscription.log
2222
oc get installplan -n "${ASSISTED_NAMESPACE}" -o yaml > ${LOGS_DEST}/oc_install_plan.log
2323
}

deploy/operator/setup_assisted_operator.sh

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,23 @@ EOF
8989

9090
function install_from_catalog_source() {
9191
catalog_source_name="${1}"
92+
if [ "${ASSISTED_UPGRADE_OPERATOR}" = "true" ]; then
93+
catalog_source=${ASSISTED_SERVICE_OPERATOR_CATALOG}
94+
else
95+
catalog_source=${catalog_source_name}
96+
fi
9297
tee << EOCR >(oc apply -f -)
98+
apiVersion: operators.coreos.com/v1alpha1
99+
kind: CatalogSource
100+
metadata:
101+
name: ${catalog_source}
102+
namespace: openshift-marketplace
103+
spec:
104+
sourceType: grpc
105+
image: ${INDEX_IMAGE}
106+
displayName: Assisted Test Registry
107+
publisher: Assisted Developer
108+
---
93109
apiVersion: v1
94110
kind: Namespace
95111
metadata:
@@ -229,19 +245,7 @@ function from_index_image() {
229245
"${INDEX_IMAGE}" "${LOCAL_REGISTRY}" "${AUTHFILE}" "${catalog_source_name}"
230246
mirror_rhcos
231247
else
232-
catalog_source_name="assisted-service-operator-catalog"
233-
tee << EOCR >(oc apply -f -)
234-
apiVersion: operators.coreos.com/v1alpha1
235-
kind: CatalogSource
236-
metadata:
237-
name: ${catalog_source_name}
238-
namespace: openshift-marketplace
239-
spec:
240-
sourceType: grpc
241-
image: ${INDEX_IMAGE}
242-
displayName: Assisted Test Registry
243-
publisher: Assisted Developer
244-
EOCR
248+
catalog_source_name=${ASSISTED_SERVICE_OPERATOR_CATALOG}
245249
fi
246250

247251
install_from_catalog_source "${catalog_source_name}"

0 commit comments

Comments
 (0)