Uninstalling foundational services
You can uninstall services by using the Operand Deployment Lifecycle Manager.
Uninstalling all services
If you want to delete all the installed services, complete the steps in this section. Complete these steps by using the command-line interface (CLI).
-
Log in to the cluster by using the
oc login
command. -
Locate the operator namespace where the
IBM Cloud Pak foundational services
operator is deployed. For example, thefoundational-services
namespace.export operatorNamespace=<foundational-services-namespace>
-
Locate the service namespace where the services are deployed.
export servicesNamespace=$(oc get commonservice common-service -n $operatorNamespace -o jsonpath='{.spec.servicesNamespace}')
-
Delete the CommonService APIs from the operator and service namespace.
oc delete commonservice common-service -n $operatorNamespace oc delete commonservice common-service -n $servicesNamespace
-
Uninstall the
IBM Cloud Pak foundational services
operator from the operator namespace.oc delete csv -l operators.coreos.com/ibm-common-service-operator.$operatorNamespace -n $operatorNamespace oc delete subscription -l operators.coreos.com/ibm-common-service-operator.$operatorNamespace -n $operatorNamespace
-
Delete the
IBM Cloud Pak foundational services
APIs from the operator namespace and service namespace.-
Delete the OperandRequest instances.
oc delete operandrequest --all -n $operatorNamespace oc delete operandrequest --all -n $servicesNamespace
-
Delete the OperandConfig instances.
oc delete operandconfig --all -n $operatorNamespace oc delete operandconfig --all -n $servicesNamespace
-
Delete the OperandRegistry instances.
oc delete operandregistry --all -n $operatorNamespace oc delete operandregistry --all -n $servicesNamespace
-
Delete the NamespaceScope instances.
oc delete namespacescope --all -n $operatorNamespace
-
-
Uninstall the Operand Deployment Lifecycle Manager operator.
oc delete csv -l operators.coreos.com/ibm-odlm.$operatorNamespace -n $operatorNamespace oc delete subscription -l operators.coreos.com/ibm-odlm.$operatorNamespace -n $operatorNamespace
-
Uninstall the IBM NamespaceScope operator if it exists.
oc delete csv -l operators.coreos.com/ibm-namespace-scope-operator.$operatorNamespace -n $operatorNamespace oc delete subscription -l operators.coreos.com/ibm-namespace-scope-operator.$operatorNamespace -n $operatorNamespace
-
Delete operator and service namespaces.
oc delete namespace $operatorNamespace oc delete namespace $servicesNamespace
Note: If namespace deletion fails or hangs, patch out the finalizers for remaining objects in the namespaces.
-
Determine which resources to patch by running the following command:
oc describe namespace <foundational-services-namespace>
Under the Conditions field, look for the NamespaceContentRemaining Type.
Conditions: Type Status LastTransitionTime Reason Message ---- ------ ------------------ ------ ------- 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
-
For each resource listed in NamespaceContentRemaining, run the following two commands:
oc get <resource type> -n <foundational-services-namespace>
For example, resource type
commonwebuis.operators.ibm.com
. Note down the names of the resources.oc patch <resource type> <resource name> -n <cs namespace> --type="json" -p '[{"op": "remove", "path":"/metadata/finalizers"}]'
-
-
-
Delete additional cluster resources.
-
Delete the
common-service-maps
ConfigMap.-
If you have other
IBM Cloud Pak foundational services
instances v3.x installed in the cluster, update thecommon-service-maps
ConfigMap inkube-public
namespace, to delete the namespace mapping for theIBM Cloud Pak foundational services
instance that you are uninstalling.oc edit configmap common-service-maps -n kube-public
For example, if you are uninstalling the
IBM Cloud Pak foundational services
instance from namespacecpfs-v4-operator-ns
andcpfs-v4-services-ns
withcloudpak-tethered-ns-a
, remove the following entry:kind: ConfigMap apiVersion: v1 metadata: name: common-service-maps namespace: kube-public data: common-service-maps.yaml: | controlNamespace: cs-control namespaceMapping: - map-to-common-service-namespace: cpfs-v4-services-ns <-- Remove this entry starting from here requested-from-namespace: - cpfs-v4-operator-ns - cpfs-v4-services-ns - cloudpak-tethered-ns-a <-- Remove this entry ending here - map-to-common-service-namespace: cpfs-v3-ns requested-from-namespace: - cpfs-v3-ns - cloudpak-tethered-ns-b
- If all the
IBM Cloud Pak foundational services
instances are v4.x in the cluster, delete thecommon-service-maps
ConfigMap inkube-public
namespace.
oc delete configmap common-service-maps -n kube-public
- If all the
-
-
Delete the
ibm-cs-ns-mapping-webhook-configuration
ValidatingWebhookConfiguration.oc delete validatingwebhookconfiguration ibm-cs-ns-mapping-webhook-configuration --ignore-not-found
-
Delete the
ibm-common-service-validating-webhook-<operator-namespace>
ValidatingWebhookConfiguration.oc delete validatingwebhookconfiguration ibm-common-service-validating-webhook-$operatorNamespace --ignore-not-found
-
Delete the
ibm-operandrequest-webhook-configuration-<operator-namespace>
MutatingWebhookConfiguration.oc delete mutatingwebhookconfiguration ibm-operandrequest-webhook-configuration-$operatorNamespace --ignore-not-found
-
Uninstalling individual services
If you want to delete one or more services, complete the following steps:
-
Log in to the cluster by using the
oc login
command. -
Find the OperandRequest created by IBM Cloud Paks in the IBM Cloud Paks namespaces.
-
Run the following command to edit the OperandRequest:
oc edit operandrequest <operandrequest-name> -n <IBM Cloud Paks namespaces>
The following is an example of an OperandRequest definition:
apiVersion: operator.ibm.com/v1alpha1 kind: OperandRequest metadata: name: common-service namespace: <IBM Cloud Paks namespaces> spec: requests: - operands: - name: ibm-im-operator - name: ibm-platformui-operator registry: common-service
-
Delete the service that you want to uninstall from your cluster from the list of
operands
. For example, if you want to uninstall theibm-platformui-operator
service, the OperandRequest definition would resemble the following code:apiVersion: operator.ibm.com/v1alpha1 kind: OperandRequest metadata: name: common-service namespace: <IBM Cloud Paks namespaces> spec: requests: - operands: - name: ibm-im-operator registry: common-service
-
Save the changes and close the editor.