From dfec951a9570ecfcd12a4dad9d13805d5f4e064a Mon Sep 17 00:00:00 2001 From: Jim Crossley Date: Wed, 9 Oct 2024 17:46:29 -0400 Subject: [PATCH] This is a crude way of accounting for an existing namespace Running 'operator-sdk run bundle-upgrade' yielded this error: Failed to run bundle upgrade: update catalog error: error in upgrading FBC: error validating/stringifying the declarative config object: error converting the declarative config to model: invalid package \"trustify-operator\", channel \"operator-sdk-run-bundle\": duplicate entry \"trustify-operator.v1.0.0-snapshot\"\n Signed-off-by: Jim Crossley --- hack/install-trustify.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hack/install-trustify.sh b/hack/install-trustify.sh index 051b387..44dc286 100755 --- a/hack/install-trustify.sh +++ b/hack/install-trustify.sh @@ -22,8 +22,16 @@ fi run_bundle() { kubectl auth can-i create namespace --all-namespaces - kubectl create namespace ${NAMESPACE} || true - operator-sdk run bundle "${OPERATOR_BUNDLE_IMAGE}" --namespace "${NAMESPACE}" --timeout "${TIMEOUT}" || operator-sdk run bundle-upgrade "${OPERATOR_BUNDLE_IMAGE}" --namespace "${NAMESPACE}" --timeout "${TIMEOUT}" || (kubectl get Subscription --namespace "${NAMESPACE}" -o yaml && exit 1) + + # delete the ns if it exists, effectively undeploying the current + # Trustify instance. This kinda defeats the purpose of operators, + # obviously, but I'm not familiar enough with the operator-sdk + # command to convince it to reinstall/upgrade the bundle -- run + # bundle-upgrade didn't work :( + kubectl delete namespace ${NAMESPACE} || true + + kubectl create namespace ${NAMESPACE} + operator-sdk run bundle "${OPERATOR_BUNDLE_IMAGE}" --namespace "${NAMESPACE}" --timeout "${TIMEOUT}" || (kubectl get Subscription --namespace "${NAMESPACE}" -o yaml && exit 1) # If on MacOS, need to install `brew install coreutils` to get `timeout` timeout 600s bash -c 'until kubectl get customresourcedefinitions.apiextensions.k8s.io trustifies.org.trustify; do sleep 30; done' \