Uninstalling License Service

Learn how to uninstall License Service.

Uninstalling License Service from the Red Hat® OpenShift® Container Platform cluster

Uninstalling License Service with the console

Complete the following steps to uninstall License Service with the OpenShift cluster console:

  1. Log in to your OpenShift cluster console.

  2. Click Operators > Installed Operators.

  3. Set Project to All projects.

  4. Select the IBM Licensing name in the Installed Operators page.

  5. Click Actions > Uninstall Operator.

  6. Select the Delete all operand instances for this operator option, and click Uninstall.

Uninstalling License Service with the CLI

Complete the following steps to uninstall License Service with the CLI:

  1. Create an environment variable with the License Service namespace.

    export ibmlicensingNamespace=<your-License-Service-namespace>
    

    where <your-License-Service-namespace> is the namespace where License Service is installed.

  2. Log in to the OpenShift cluster using oc login command, and switch to the License Service project.

     oc login --token=<token> --server=<server-url>
     oc project ${ibmlicensingNamespace}
    
  3. Delete the IBMLicensing instance, csv, and subscription of License Service.

     oc delete ibmlicensing instance
     oc delete csv ibm-licensing-operator.v4.2.8 -n ${ibmlicensingNamespace}
     oc delete subscription ibm-licensing-operator-app -n ${ibmlicensingNamespace}
    

Uninstalling License Service from the Kubernetes cluster

  1. Create an environment variable with the License Service namespace.

    export ibmlicensingNamespace=<your-License-Service-namespace>
    

    where <your-License-Service-namespace> is the namespace where License Service is installed.

  2. Log in to the Kubernetes cluster and use the following command to switch to the License Service context.

    kubectl config set-context --current --namespace=${ibmlicensingNamespace}
    
  3. Delete the IBMLicensing instance, csv, and subscription of License Service.

    kubectl delete ibmlicensing instance
    kubectl delete csv ibm-licensing-operator.v4.2.8 -n ${ibmlicensingNamespace}
    kubectl delete subscription ibm-licensing-operator-app -n ${ibmlicensingNamespace}
    

Uninstalling License Service without Operator Lifecycle Manager (OLM)

Before you begin

Before you begin uninstallation, check whether you still have access to the License Service directory that you used for installation. The directory is a copy of the operator GitHub repository for your installed release.

If you have access to the License Service directory, go to Uninstalling License Service.

If you do not have access to the License Service directory, complete the following steps before you start uninstallation.

  1. Run the following command to export your License Service namespace.

    export ibmlicensingNamespace=<your-License-Service-namespace>
    

    where <your-License-Service-namespace> is the namespace where License Service is installed.

  2. Set the context to create the required resources.

    current_context=$(kubectl config current-context)
    kubectl config set-context ${current_context} --namespace=${ibmlicensingNamespace}
    
  3. Use git clone to clone the GitHub repository of License Service.

    export operator_release_version=latest-4.x
    git clone -b ${operator_release_version} https://github.com/IBM/ibm-licensing-operator.git
    cd ibm-licensing-operator/
    
  4. If you install License Service in a namepsace different than ibm-licensing, which is the default, switch the namespace in role-based access control (RBAC) with the following command:

    • For LINUX:

      if [ "${ibmlicensingNamespace}" != "" ] && [ "${ibmlicensingNamespace}" != "ibm-licensing" ]; then
       sed -i 's|namespace: ibm-licensing|namespace: '"${ibmlicensingNamespace}"'|g' config/rbac/*.yaml
      fi
      
    • For MAC:

      if [ "${ibmlicensingNamespace}" != "" ] && [ "${ibmlicensingNamespace}" != "ibm-licensing" ]; then
       sed -i '' 's|namespace: ibm-licensing|namespace: '"${ibmlicensingNamespace}"'|g' config/rbac/*.yaml
      fi
      
  5. Run the following command to modify the operator.yaml image based on tags.

    • For Linux:

      `sed -i "s/annotations\['olm.targetNamespaces'\]/namespace/g" config/manager/manager.yaml`
      
    • For MAC:

      sed -i "" "s/annotations\['olm.targetNamespaces'\]/namespace/g" config/manager/manager.yaml`
      

Uninstalling License Service

Run the following set of commands to uninstall License Service.

cd ibm-licensing-operator/
#delete CRDs:
kubectl delete -f config/crd/bases/operator.ibm.com_ibmlicensings.yaml
kubectl delete -f config/crd/bases/operator.ibm.com_ibmlicensingmetadatas.yaml
kubectl delete -f config/crd/bases/operator.ibm.com_ibmlicensingdefinitions.yaml
kubectl delete -f config/crd/bases/operator.ibm.com_ibmlicensingquerysources.yaml

#delete rbacs:
kubectl delete -f config/rbac/role.yaml
kubectl delete -f config/rbac/role_operands.yaml
kubectl delete -f config/rbac/service_account.yaml
kubectl delete -f config/rbac/role_binding.yaml

#delete deployment:
kubectl delete -f config/manager/manager.yaml