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. Remove the following configmaps, secrets, and namespace.

    oc -n kube-system delete secret icp-metering-api-secret
    oc -n kube-public delete configmap ibmcloud-cluster-info
    oc -n kube-public delete configmap ibm-common-services-status
    oc -n kube-public delete secret ibmcloud-cluster-ca-cert
    oc delete ValidatingWebhookConfiguration cert-manager-webhook ibm-cs-ns-mapping-webhook-configuration --ignore-not-found
    oc delete MutatingWebhookConfiguration cert-manager-webhook ibm-common-service-webhook-configuration ibm-operandrequest-webhook-configuration namespace-admission-config --ignore-not-found
    oc delete namespace services
    oc delete nss --all
    

    Note: After you uninstall services, the Custom resources definitions (CRDs) are not deleted. If needed, you can manually delete the CRDs that you do not want.

    1. Get the CRDs.

      oc get crd | grep ibm.com
      
    2. Delete the CRDs that you do not want.

      oc delete crd <CRD1> <CRD2> ...<CRDn>
      

    Note: After you uninstall services, the nss-runtime-managed-role-from-<namespace> Role is not deleted. You must manually delete the role by running the following command.

    oc get role --no-headers --all-namespaces -o=custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace | grep nss-runtime-managed-role-from | while read role; do
      role_name=$(echo $role | awk '{print $1}')
      role_namespace=$(echo $role | awk '{print $2}')
      oc -n ${role_namespace} delete role ${role_name}
    done
    
  5. Delete the ibm-common-services namespace.

    1. Click Home > Projects, and find the ibm-common-services project.

    2. Click the overflow menu icon and click Delete Project.

  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.