Uninstalling foundational services

You can uninstall services by using the Operand Deployment Lifecycle Manager.

Note: The default ibm-common-services namespace is used in the commands in the following sections. However, if you installed IBM Cloud Pak foundational services in a custom namespace in your cluster, replace ibm-common-services with your custom namespace in the commands.

Uninstalling all services

If you want to delete all the installed services, complete the steps in this section. Complete these steps from your OpenShift cluster console.

  1. Uninstall the IBM Cloud Pak foundational services operator. Switch to the namespace where you deployed the IBM Cloud Pak foundational services operator. For example, the ibm-common-services namespace. Then, click Operators > Installed Operators > the overflow menu icon > Uninstall Operator.

  2. Delete the operator APIs from the ibm-common-services namespace.

    1. Switch to the ibm-common-services namespace.

    2. Delete the OperandRequest instances.

      1. Click Operators > Installed Operators > Operand Deployment Lifecycle Manager > OperandRequest.

      2. Delete all the OperandRequest instances that you created. When an OperandRequest instance is deleted, the services that are requested by this OperandRequest instance are deleted unless the service is requested by other OperandRequest instances.

      3. Wait for the OperandRequest instances to be deleted.

    3. Delete the OperandConfig instances.

      1. Click Operators > Installed Operators > Operand Deployment Lifecycle Manager > OperandConfig.

      2. Delete all the OperandConfig instances.

    4. Delete the OperandRegistry instances.

      1. Click Operators > Installed Operators > Operand Deployment Lifecycle Manager > OperandRegistry.

      2. Delete all the OperandRegistry instances.

    5. Delete the NamespaceScope instances.

      1. Click Operators > Installed Operators > IBM NamespaceScope Operator > NamespaceScope.

      2. Delete all the NamespaceScope instances.

  3. Uninstall the Operand Deployment Lifecycle Manager operator.

    1. Switch to the openshift-operators namespace.

    2. Click Operators > Installed Operators > the overflow menu icon > Uninstall Operator.

  4. Delete the targeted namespace with the following command:

    oc delete namespace <cs namespace>
    
  5. If namespace deletion fails or hangs, patch out the remaining finalizers. This can be done in another terminal or you can cancel the delete command by using Control + C (also Control + C for MacOS). Follow the following steps:

    1. Determine which resources need to be patched by running:

      oc describe namespace <cs namespace>
      
    2. Under the Conditions field near the bottom of the output, look for the NamespaceContentRemaining Type.

      Tip: Refer to the following example:

      Conditions:
        Type                                         Status  LastTransitionTime               Reason                Message
        ----                                         ------  ------------------               ------                -------
        NamespaceDeletionDiscoveryFailure            False   Wed, 25 Jan 2023 12:10:16 -0800  ResourcesDiscovered   All resources successfully discovered
        NamespaceDeletionGroupVersionParsingFailure  False   Wed, 25 Jan 2023 12:10:16 -0800  ParsedGroupVersions   All legacy kube types successfully parsed
        NamespaceDeletionContentFailure              False   Wed, 25 Jan 2023 12:11:07 -0800  ContentDeleted        All content successfully deleted, may be waiting on finalization
        NamespaceContentRemaining                    True    Wed, 25 Jan 2023 12:10:16 -0800  SomeResourcesRemain   Some resources are remaining: commonwebuis.operators.ibm.com has 1 resource instances, nginxingresses.operator.ibm.com has 1 resource instances, oidcclientwatchers.operator.ibm.com has 1 resource instances, operandbindinfos.operator.ibm.com has 2 resource instances, platformapis.operator.ibm.com has 1 resource instances
        NamespaceFinalizersRemaining                 True    Wed, 25 Jan 2023 12:10:16 -0800  SomeFinalizersRemain  Some content in the namespace has finalizers remaining: commonui.operators.ibm.com in 1 resource instances, commonui1.operators.ibm.com in 1 resource instances, finalizer.bindinfo.ibm.com in 2 resource instances, helm.sdk.operatorframework.io/uninstall-release in 2 resource instances, oidclientwatcher.operator.ibm.com in 1 resource instances
      
    3. For each resource listed in NamespaceContentRemaining, run the following two commands:

      oc get <resource type> -n <cs namespace>
      

      For example, commonwebuis.operators.ibm.com or nginxingresses.operator.ibm.com. Note down the name of the resources.

      oc patch <resource type> <resource name> -n <cs namespace> --type="json" -p '[{"op": "remove", "path":"/metadata/finalizers"}]'
      

      Run the preceding command for each resource that is shown in the output by the previous command oc get <resource type> -n <cs namespace.

  6. Verify that the uninstallation is successful.

     oc get namespace ibm-common-services
    

    If the command returns an error message that the namespace is not found, it means that the uninstallation is complete. See the following example message:

     Error from server (NotFound): namespaces "ibm-common-services" not found
    

Uninstalling individual services

If you want to delete one or more services, complete these steps:

  1. Log in to your OpenShift cluster console.

  2. Switch to the ibm-common-services namespace by selecting ibm-common-services from the Project drop-down list.

  3. Access the OperandRequest API. Click Operators > Installed Operators > Operand Deployment Lifecycle Manager > OperandRequest.

  4. Click Edit OperandRequest. Following is a sample content:

     apiVersion: operator.ibm.com/v1alpha1
     kind: OperandRequest
     metadata:
       name: common-service
       namespace: ibm-common-services
     spec:
       requests:
         - operands:
             - name: etcd
             - name: jenkins
           registry: common-service
    
  5. For the service that you want to uninstall in your cluster, delete it from the operands list. For example, if you want to uninstall the jenkins service, the OperandRequest definition would resemble the following code:

     apiVersion: operator.ibm.com/v1alpha1
     kind: OperandRequest
     metadata:
       name: common-service
       namespace: ibm-common-services
     spec:
       requests:
         - operands:
             - name: etcd
           registry: common-service
    
  6. Click Save. The service is uninstalled from your cluster.