Uninstalling Watson Discovery

An instance administrator can uninstall Watson Discovery.

Who needs to complete this task?

Instance administrator To uninstall Watson Discovery, you must be an instance administrator. An instance administrator has permission to manage software in the following projects:

The operators project for the instance

The operators for this instance of Cloud Pak for Data are installed in the operators project. In the uninstall commands, the ${PROJECT_CPD_INST_OPERATORS} environment variable refers to the operators project.

The operands project for the instance

The Cloud Pak for Data control plane and the services for this instance of Cloud Pak for Data are installed in the operands project. In the uninstall commands, the ${PROJECT_CPD_INST_OPERANDS} environment variable refers to the operands project.

When do you need to complete this task?

Complete this task if you want to remove Watson Discovery from an instance of Cloud Pak for Data.

Repeat as needed If you are responsible for multiple instances of Cloud Pak for Data, you can repeat this task to remove other instances of Watson Discovery on the cluster.

Information you need to complete this task

Review the following information before you uninstall Watson Discovery:

Environment variables
The commands in this task use environment variables so that you can run the commands exactly as written.
  • If you don't have the script that defines the environment variables, see Setting up installation environment variables.
  • To use the environment variables from the script, you must source the environment variables before you run the commands in this task. For example, run:
    source ./cpd_vars.sh

Procedure

Complete the following tasks to uninstall Watson Discovery:

  1. Deleting service instances
  2. Uninstalling the service
  3. Removing associated resources

Deleting service instances

Before you uninstall Watson Discovery, you must delete any service instances that are associated with Watson Discovery to ensure that each instance releases the resources that it reserved.

Who needs to complete this task?
A user with the Manage service instances permission must complete this task.
When do you need to complete this task?
Complete this task before you uninstall Watson Discovery.

From the Cloud Pak for Data web client:

  1. Log in to the web client as a user with sufficient permissions to complete the task.
  2. From the menu, select Services > Instances.
  3. Filter the list to show the discovery type.
  4. Delete each discovery instance in the list.

Uninstalling the service

To uninstall Watson Discovery:

  1. Log the cpd-cli in to the Red Hat® OpenShift® Container Platform cluster:
    ${CPDM_OC_LOGIN}
    Remember: CPDM_OC_LOGIN is an alias for the cpd-cli manage login-to-ocp command.
  2. Create an environment variable named OPERAND_NAME to store the operand name for Watson Discovery.
    oc get WatsonDiscovery --namespace ${PROJECT_CPD_INST_OPERANDS}
    export OPERAND_NAME=<operand_name>
  3. Delete the wd custom resource for Watson Discovery.
    cpd-cli manage delete-cr \
    --components=watson_discovery \
    --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS}
    Wait for the cpd-cli to return the following message before you proceed to the next step:
    [SUCCESS]... The delete-cr command ran successfully
  4. Delete the OLM objects for Watson Discovery:
    cpd-cli manage delete-olm-artifacts \
    --cpd_operator_ns=${PROJECT_CPD_INST_OPERATORS} \
    --components=watson_discovery

    Wait for the cpd-cli to return the following message:

    [SUCCESS]... The delete-olm-artifacts command ran successfully

Removing associated resources

Complete these additional steps to clean up after the service is removed:
  1. Run the following command to delete a resource that is not labeled.
    oc delete pvc wd-minio-discovery-backup-pvc
  2. Run the following command to list the resources that were created by Watson Discovery and verify that they are deleted. The -l parameter is a lowercase L that is used to request a list.
    
    oc get all,wdall,role,rolebinding,secret,serviceaccount,rabbitmqcluster,miniocluster,etcdcluster,cluster.postgresql.k8s.enterprisedb.io,\
    watsongateway,modeltrain,certificate,elasticsearchcluster -l 'icpdsupport/addOnId=discovery'

    If Watson Discovery was uninstalled successfully, the response is empty. If it is not, delete any remaining resources by using the oc delete resource-type resource-name command.

  3. Verify that all persistent volume claim (PVC) resources that were created by Watson Discovery are deleted. Run the following commands to list any remaining persistent volume claim (PVC) resources:
    oc get pvc -l 'app.kubernetes.io/name in (wd,discovery)'
    oc get pvc -l 'etcd_cluster=wd-discovery-etcd'
    If any remaining PVC resources are listed, delete them by running the following command for each resource in turn:
    oc delete pvc pvc-name
  4. Remove Watson Discovery data from Multicloud Object Gateway by completing the following steps:
    1. Install S3 CLI.

    2. Run the describe command to display the S3 command snippets and obtain MCG access keys.
      $ oc describe noobaa -n openshift-storage
      ...
        Test S3 client:
      
          kubectl port-forward -n openshift-storage service/s3 10443:443 &
          NOOBAA_ACCESS_KEY=$(kubectl get secret noobaa-admin -n openshift-storage -o json | jq -r '.data.AWS_ACCESS_KEY_ID|@base64d')
          NOOBAA_SECRET_KEY=$(kubectl get secret noobaa-admin -n openshift-storage -o json | jq -r '.data.AWS_SECRET_ACCESS_KEY|@base64d')
          alias s3='AWS_ACCESS_KEY_ID=$NOOBAA_ACCESS_KEY AWS_SECRET_ACCESS_KEY=$NOOBAA_SECRET_KEY aws --endpoint https://localhost:10443 --no-verify-ssl s3'
          s3 ls
    3. Run the snippets to setup MCG access keys with S3 CLI.
      $ oc port-forward -n openshift-storage service/s3 10443:443 &
      $ NOOBAA_ACCESS_KEY=$(oc get secret noobaa-admin -n openshift-storage -o json | jq -r '.data.AWS_ACCESS_KEY_ID|@base64d')
      $ NOOBAA_SECRET_KEY=$(oc get secret noobaa-admin -n openshift-storage -o json | jq -r '.data.AWS_SECRET_ACCESS_KEY|@base64d')
      $ alias s3='AWS_ACCESS_KEY_ID=$NOOBAA_ACCESS_KEY AWS_SECRET_ACCESS_KEY=$NOOBAA_SECRET_KEY aws --endpoint https://localhost:10443 --no-verify-ssl s3'
    4. Run the following command to list the buckets after the keys are set.
      $ s3 ls s3://
    5. Delete the following objects and buckets that were created by Watson Discovery:
      • common
      • cnm
      • elastic-backup
      • exported-documents
      • ranker-wire-all
      • sdu
      • sentence-classification-input
      • sentence-classification-results
      To do so, do one of the following things:
      • Run the following command one time for each item in the list and replace <bucket> with a name from the list:
        bucket_full_name="<bucket>-${PROJECT_CPD_INST_OPERANDS}-${OPERAND_NAME}"
        # Empty the bucket.
        s3 rm --recursive "s3://${bucket_full_name}"
        # Delete the bucket.
        s3 rb "s3://${bucket_full_name}"
      • Remove all buckets at once.
        # Delete buckets.
        MCG_BUCKETS=("common" "sdu" "sentence-classification-input"
            "sentence-classification-results" "exported-documents" "elastic-backup" "ranker-wire-all" "cnm")
        for bucket in "${MCG_BUCKETS[@]}"; do
            bucket_full_name="${bucket}-${PROJECT_CPD_INST_OPERANDS}-${OPERAND_NAME}"
            # Empty the bucket.
            s3 rm --recursive "s3://${bucket_full_name}"
            # Delete the bucket.
            s3 rb "s3://${bucket_full_name}"
        done
  5. Verify that all secret resources that were created by the service are deleted. Run the following commands to list any remaining resources:
    oc get secret wd-discovery-cert-manager-tls wd-discovery-kes-client-secret noobaa-account-watson-discovery noobaa-cert-watson-discovery
  6. If any resources are listed, delete them by running the following command for each resource one at a time:
    oc delete secret {secret-name}