Uninstalling the remaining resources after migrating to foundational services version 4.x

After you upgrade IBM Cloud Pak foundational services from version 3.x to 4.x, some components of the foundational services remain in the control namespace. You can remove these components automatically by using the script, or manually.

Using the script to automatically check and uninstall foundational services version 3.x remaining components

To uninstall the remaining components, you can download the following script from the scripts-adopter branch of the ibm-common-service-operator GitHub repository: cleanup_cp2_control.sh.

Parameters:

 --oc string                                    File path to oc CLI. Default uses oc in your PATH
 -h, --help                                     Print usage information
 --enable-licensing                             Set this flag to check ibm-licensing-operator

Example

./cleanup_cp2_control.sh --enable-licensing

Manually uninstalling foundational services version 3.x components

You can use the OpenShift console or run commands to uninstall the remaining resources after upgrading to foundational services version 4.x.x.

Prerequisites

  1. Check the common-service-maps ConfigMap in the kube-public namespace to get all namespaces where foundational services is installed. Note: Namespaces that are listed in the common-service-maps ConfigMap entries do not have an ibm-common-service-operator on v3.x version.
  2. If the cert-manager operator or operand is deployed in controlNamespace listed in common-service-maps ConfigMap, another instance of cert-manager (regardless of its version, and whether it is from IBM, Red Hat, or community) should exist in another namespace.

Uninstalling operators and operands

  1. Uninstall the ibm-namespace-scope operator and its operand in controlNamespace.

    1. Delete the NamespaceScope instances in the controlNamespace.
      • OpenShift console: Click Operators > Installed Operators > IBM NamespaceScope Operator > NamespaceScope and delete all the NamespaceScope instances.
      • CLI: Find the NamespaceScope instances in the controlNamespace:
         oc delete namespacescope odlm-scope-managedby-odlm nss-odlm-scope nss-managedby-odlm -n <controlNamespace> --ignore-not-found
        
    2. Delete the ibm-namespace-scope operator.

      • OpenShift console: Click Operators > Installed Operators > IBM NamespaceScope Operator > Uninstall Operatorand delete the ibm-namespace-scope operator.
      • CLI: Run the following commands to delete the ibm-namespace-scope operator:

        oc get csv -n <controlNamespace> | grep ibm-namespace-scope-operator
        
         oc delete csv <csv_name> -n <controlNamespace>
        
        oc delete sub ibm-namespace-scope-operator -n <controlNamespace> --ignore-not-found
        
  2. Uninstall ibm-common-service-webhook and its operand.

    1. Remove the ibm-common-service-webhook deployment.

      • OpenShift console: Click Workloads > Deployments > ibm-common-service-webhook > Delete Deployment.
      • CLI: Run the following command to delete this deployment:
         oc delete deployment ibm-common-service-webhook -n <controlNamespace>
        
    2. Remove MutatingWebhookConfigurations.

      • OpenShift console: Click Home > Search > MutatingWebhookConfiguration and delete the following resources: ibm-common-service-webhook-configuration and ibm-operandrequest-webhook-configuration.
      • CLI: Run the following commands to delete ibm-cs-ns-mapping-webhook-configuration:
         oc delete MutatingWebhookConfiguration ibm-common-service-webhook-configuration ibm-operandrequest-webhook-configuration --ignore-not-found
        
    3. Remove ValidatingWebhookConfigurations.

      • OpenShift console: Click Home > Search > ValidatingWebhookConfiguration and delete ibm-cs-ns-mapping-webhook-configuration.
      • CLI: Run the following command to delete ibm-cs-ns-mapping-webhook-configuration:
         oc delete ValidatingWebhookConfiguration ibm-cs-ns-mapping-webhook-configuration --ignore-not-found
        
    4. Remove podpresets instance.

      • OpenShift console: Click Home > Search > Podpresets.
      • CLI: Run the following command to delete the podpresets resources:
         oc get podpresets.operator.ibm.com -A --no-headers | awk '{print $1}' | xargs oc delete -n $ns --ignore-not-found podpresets.operator.ibm.com
        
  3. Uninstall ibm-secret-share-operator and its operand.

    1. Remove ibm-secret-share-operator deployment.

      • OpenShift console: Click Workloads > Deployments > secretshare > Delete Deployment.
      • CLI: Run the following command to delete the deployment:
         oc delete deployment secretshare -n <controlNamespace>
        
    2. Remove secretshare instance.

      • OpenShift console: Click Home > Search > SecretShare, to delete all secretshare instances
      • CLI: Run the following command to delete the resources:
         oc get secretshare -A --no-headers | awk '{print $1}' | xargs oc delete -n $ns --ignore-not-found secretshare
        
  4. Uninstall ibm-crossplane-operator and ibm-corssplane-provider-operator operator and its operands.

    1. Remove Corssplane instance.

      • OpenShift console: Click Home > Search and find and delete the following resources: configuration.pkg.ibm.crossplane.io, lock.pkg.ibm.crossplane.io, ProviderConfig.
      • CLI: Run the following commands to delete the resources:

         oc get configuration.pkg.ibm.crossplane.io -A --no-headers | awk '{print $1}' | xargs oc delete --ignore-not-found configuration.pkg.ibm.crossplane.io
        
         oc get lock.pkg.ibm.crossplane.io -A --no-headers | awk '{print $1}' | xargs oc delete --ignore-not-found lock.pkg.ibm.crossplane.io
        
         oc get ProviderConfig -A --no-headers | awk '{print $1}' | xargs oc delete --ignore-not-found ProviderConfig
        
    2. Remove crossplane CSV and subscriptions.

      • You can run the following command to delete the crossplane CSV and subscriptions:

         oc get csv -n <controlNamespace> | grep ibm-crossplane
        
         oc delete csv <csv_name>  -n <controlNamespace>
        
         oc delete sub ibm-crossplane-operator-app -n <controlNamespace> --ignore-not-found
        
         oc delete sub ibm-crossplane-provider-kubernetes-operator-app -n <controlNamespace> --ignore-not-found
        
         oc delete sub ibm-crossplane-provider-ibm-cloud-operator-app -n <controlNamespace> --ignore-not-found
        
  5. Uninstall Audit Logging resources.

    1. Remove Audit Logging resources.
      • OpenShift console: Click Home > Search > AuditLogging and delete it.
      • CLI: Run the following command to delete the resources:
         oc get auditlogging -A --no-headers | awk '{print $1}' | xargs oc delete -n $ns --ignore-not-found auditlogging
        
  6. Uninstall IBM Cert Manager v3 operator and its operands.

    1. Remove Cert Manager resources.

      • OpenShift console: Click Home > Search > certmanager and delete it.
      • CLI: Run the following command to delete the resources:
         oc get certmanager.operator.ibm.com -A --no-headers | awk '{print $1}' | xargs oc delete -n $ns --ignore-not-found certmanager.operator.ibm.com
        
    2. Remove Cert Manager CSV and subscriptions.

      • You can run the following commands to delete the Cert Manager CSV and subscriptions:

         oc get csv -n <controlNamespace> | grep ibm-cert-manager-operator.v3
        
         oc delete csv <csv_name> -n <controlNamespace>
        
         oc delete sub ibm-cert-manager-operator -n <controlNamespace> --ignore-not-found