Uninstalling WebSphere Liberty operator

You can uninstall the WebSphere® Liberty operator with Red Hat® OpenShift® CLI (oc) commands or Kubernetes kubectl commands.

Before you begin

Set the environment variables for the WebSphere Liberty operator namespace. For example, the default steps for installation that uses the Red Hat OpenShift console use the following namespace:

WLO_NAMESPACE=openshift-operators

For a non-OCP Kubernetes environment, use this namespace:

WLO_NAMESPACE=operators

Uninstalling the WebSphere Liberty operator

To uninstall the WebSphere Liberty operator operator, run oc or kubectl commands that delete the WebSphere Liberty operator subscription, ClusterServiceVersion (CSV), and CustomResourceDefinition (CRD) resources. Be sure to set the WLO_NAMESPACE environment variable.

  1. Log in to the cluster as a cluster administrator.
  2. Optional: Delete the WebSphere Liberty operator CustomResourceDefinition (CRD) resources.
    Warning: Deleting the CRD also deletes all instances of the WebSphereLibertyApplication, WebSphereLibertyDump, and WebSphereLibertyTrace custom resources in the cluster. Skip this step if you are planning to install the WebSphere Liberty operator again and want the existing instances of these custom resources to be managed by the new instance of the Operator.
    For Red Hat OpenShift, use this command:
    WLO_CRD_NAMES=$(oc get crd -o name | grep liberty.websphere | cut -d/ -f2)
    oc delete crd $WLO_CRD_NAMES

    For kubectl, use this command:

    WLO_CRD_NAMES=$(kubectl get crd -o name | grep liberty.websphere | cut -d/ -f2)
    kubectl delete crd $WLO_CRD_NAMES
  3. If you use Operator Lifecycle Manager (OLM), delete the WebSphere Liberty operator subscription. For Red Hat OpenShift, use this command:
    WLO_SUBSCRIPTION_NAME=$(oc -n $WLO_NAMESPACE get subscription -o name | grep websphere-liberty | cut -d/ -f2)
    oc -n $WLO_NAMESPACE delete subscription $WLO_SUBSCRIPTION_NAME

    For kubectl, use this command:

    WLO_SUBSCRIPTION_NAME=$(kubectl -n $WLO_NAMESPACE get subscription -o name | grep websphere-liberty | cut -d/ -f2)
    kubectl -n $WLO_NAMESPACE delete subscription $WLO_SUBSCRIPTION_NAME
  4. Remove the WebSphere Liberty operator ClusterServiceVersion (CSV). For Red Hat OpenShift, use this command:
    WLO_CSV_NAME=$(oc -n $WLO_NAMESPACE get csv -o name | grep websphere-liberty | cut -d/ -f2)
    oc -n $WLO_NAMESPACE delete csv $WLO_CSV_NAME

    For kubectl, use this command:

    WLO_CSV_NAME=$(kubectl -n $WLO_NAMESPACE get clusterserviceversion -o name | grep websphere-liberty | cut -d/ -f2)
    kubectl -n $WLO_NAMESPACE delete clusterserviceversion $WLO_CSV_NAME