Skip to content

Commit

Permalink
usingibm-licensing-service-instance deployment to ensure the exact …
Browse files Browse the repository at this point in the history
…namespace (#2206)

* `ibm-licensing-service-instance` deployment to ensure the exact namespace

Signed-off-by: Allen Li <[email protected]>

* add detail in error message

Signed-off-by: Allen Li <[email protected]>

---------

Signed-off-by: Allen Li <[email protected]>
  • Loading branch information
qpdpQ authored Sep 19, 2024
1 parent 25e6388 commit 930b87b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cp3pt0-deployment/setup_singleton.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,18 @@ function is_migrate_licensing() {
fi

title "Check migrating LTSR ibm-licensing-operator"

local ns=$("$OC" get deployments -A | grep ibm-licensing-operator | cut -d ' ' -f1)
local ns=$("$OC" get deployments -A | grep ibm-licensing-service-instance | cut -d ' ' -f1)
if [ -z "$ns" ]; then
info "No LTSR ibm-licensing-operator to migrate, skipping"
return 0
fi

local licensing_service_count=$("$OC" get deployments -A | grep ibm-licensing-service-instance | wc -l)
# If multiple Licensing service deployment is found, it should error out
if [ "$licensing_service_count" -ge 2 ]; then
error "More than one ibm-licensing-service-instance found in namespace: $ns. There should be only one ibm-licensing-service-instance each cluster."
fi

local version=$("$OC" get ibmlicensings.operator.ibm.com instance -o jsonpath='{.spec.version}' --ignore-not-found)
if [ -z "$version" ]; then
warning "No version field in ibmlicensing CR, skipping"
Expand Down Expand Up @@ -383,7 +388,7 @@ function install_licensing() {
info "There is no ibm-licensing-operator-app Subscription installed\n"
fi

local ns=$("$OC" get deployments -A | grep ibm-licensing-operator | cut -d ' ' -f1)
local ns=$("$OC" get deployments -A | grep ibm-licensing-service-instance | cut -d ' ' -f1)
if [ ! -z "$ns" ]; then
if [ "$ns" != "$LICENSING_NAMESPACE" ]; then
error "An ibm-licensing-operator already installed in namespace: $ns, expected namespace is: $LICENSING_NAMESPACE"
Expand Down

0 comments on commit 930b87b

Please sign in to comment.