Removing API Connect on OpenShift or Cloud Pak for Integration

Remove your entire API Connect deployment on OpenShift or Cloud Pak for Integration.

About this task

These instructions completely remove API Connect, including PVCs and secrets. Because API Connect was deployed using a single, top-level CR, you cannot delete individual subsystems.

Attention: Run the commands in the sequence shown on this page. If you run commands out of sequence, you might encounter a problem where the deletion of namespaces hangs.

Procedure

  1. Run the following command to determine the name of your API Connect instance:
    oc get apiconnectcluster -n <APIC-namespace>
  2. Run the following command to delete the API Connect operands (subsystems):
    oc delete apiconnectcluster <name_of_instance> -n <APIC-namespace>
  3. Run the following command to delete the API Connect backup and restore CRs:
    oc delete apic --all -n <APIC-namespace>
  4. If you intend to completely remove API Connect, delete the operator deployments by completing the following steps:

    The API Connect operator might have created a number of operand requests with IBM Cloud Pak foundational services (previously called Common Services) to deploy services such as Cert-Manager. In addition, API Connect requires the use of a DataPower gateway, so the DataPower operator might be installed in the API Connect namespace. If those artifacts are no longer needed, uninstall them individually.

    Note: DataPower can be deployed on its own without API Connect. It is possible that the DataPower operator was installed for another purpose and not for use with API Connect, so make sure you know why the DataPower operator was installed before removing it.
    1. Open the OpenShift web console and navigate to Installed Operators in the API Connect namespace.
    2. For each operator, click on the options menu, and select Uninstall Operator.

    Deleting the operators from the web console ensures that related subscriptions, CSVs, and install plans are also removed.

  5. Run the following command to delete the secrets associated with your deleted API Connect cluster:
    oc get secrets --no-headers -n <APIC-namespace> | cut -d' ' -f1 | grep "^<first_10_characters_of_instance_name>-" | xargs oc delete secret -n <APIC-namespace>

    where <first_10_characters_of_instance_name> refers to the name of your API Connect instance.

    Note: This step assumes that any secrets that you want to keep in your namespace do not have a name that starts with the same 10 first characters of the API Connect Cluster name.
  6. Run the following command to delete the PVCs associated with your deleted API Connect cluster:
    Important: Only run this command if there is nothing other than API Connect deployed in the namespace.
    oc delete pvc -n <APIC-namespace> -l app.kubernetes.io/managed-by=ibm-apiconnect
  7. Run the following command to delete the CrunchyData Postgres cluster associated with your deleted API Connect cluster:
    oc delete pvc -n <APIC-namespace> -l vendor=crunchydata
    Note: This assumes that there is no other CrunchyData Postgres cluster in the same namespace.
  8. Run the following commands to delete the API Connect secret rotation CRs for the cluster:
    oc delete mgmtsr -n <APIC-namespace>  --all
    oc delete ptlsr -n <APIC-namespace> --all
  9. If you intend to completely remove API Connect and you created a namespace specifically for API Connect, you can delete the namespace.

    Deleting the namespace removes any remaining certificates and secrets.

    Attention: Do not deleted a shared namespace.

What to do next

Continue to Removing postgres resources on OpenShift and Cloud Pak for Integration, and make sure that all of the postgres files from Crunchy Data are deleted.