Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usingibm-licensing-service-instance deployment to ensure the exact namespace #2206

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading