How to uninstall Data Solutions Operator in TKGm clusters running in Cloud Director
search cancel

How to uninstall Data Solutions Operator in TKGm clusters running in Cloud Director

book

Article ID: 312276

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

This article provides steps to uninstall Data Solutions Operator from TKGm clusters by Cloud Director API calls and Kubectl commands.

Symptoms:
  • VMware Cloud Director extension for Data Solutions is a plug-in for VMware Cloud Director, which enables multi-tenancy customers to create Data Solutions instances in their TKGm clusters.
  • A Data Solutions Operator will be installed to TKGm clusters as the prequisite to use Data Solutions.
  • Data Solutions extension UI in Cloud Director does not provide a user interface for customers to uninstall Data Solutions Operator.


Environment

VMware Cloud Director 10.x

Resolution

If you want to remove the Data Solutions Operator from a TKGm cluster, you can take following steps.

1. Update YamlSet of CAPVCDCluster RDE in Cloud Director

Since from CSE (Container Services Extension) 4.0, Cloud Director introduces an RDE (Runtime Defined Entity) CAPVCDCluster to record customer resources to be installed to the target TKGm cluster. Data Solutions Operator installation status is also recroded in this RDE.
You need to remove custom resources with label vcd-ds/installation-manifest: "true" from the yamlSet section of the target RDE CAPVCDClustrer. See below instructions and examples for Cloud Director API calls.

1.1 List all CAPVCDCluster instances and find the target cluster entity ID.

Make an API call GET /cloudapi/1.0.0/entities/types/vmware/capvcdCluster/1.1.0 with the Kubernetes cluster owner's JWT user token. You will get an API response like below. Compare the name and remember the entity ID for the target cluster from which you want to uninstall Data Solutions Operator.
The API request is as below:
GET /cloudapi/1.0.0/entities/types/vmware/capvcdCluster/1.1.0 HTTP/1.1
Host: <vcd-rest-endpoint>
Authorization: Bearer <k8s-owner-jwt-token>
Accept: application/json;version=37.0

The API response is as below:
{
    "resultTotal": 1,
    "pageCount": 1,
    "page": 1,
    "pageSize": 25,
    "associations": null,
    "values": [
        {
            "id": "urn:vcloud:entity:vmware:capvcdCluster:<CAP_VCD_CLUSTER_UUID>",
            "entityType": "urn:vcloud:type:vmware:capvcdCluster:1.1.0",
            "name": "cluster1",
            "externalId": "urn:vcloud:vapp:<VAPP_UUID>",
            ...
        }
    ]
}

1.2 Get the single RDE instance for the target CAPVCDClustrer, and fetch the Etag value from the response header.

Make an API call GET /cloudapi/1.0.0/entities/urn:vcloud:entity:vmware:capvcdCluster:<CAP_VCD_CLUSTER_UUID> with the Kubernetes cluster owner's JWT user token. Here the sample ID <VAPP_UUID> is taken from last step's response payload.
The API request is as below.
GET /cloudapi/1.0.0/entities/urn:vcloud:entity:vmware:capvcdCluster:<CAP_VCD_CLUSTER_UUID> HTTP/1.1
Host: <vcd-rest-endpoint>
Authorization: Bearer <k8s-owner-jwt-token>
Accept: application/json;version=37.0

The API response is as below.
Response Header: "Etag: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=--gzip"

{
    "id": "urn:vcloud:entity:vmware:capvcdCluster:<CAP_VCD_CLUSTER_UUID>",
    "entityType": "urn:vcloud:type:vmware:capvcdCluster:1.1.0",
    "name": "cluster1",
    "externalId": "urn:vcloud:vapp:<VAPP_UUID>",
    "entity": {
        "kind": "CAPVCDCluster",
        "spec": {
            "vcdKe": {
                "isVCDKECluster": true,
                "autoRepairOnErrors": true,
                "defaultStorageClassOptions": {
                    "filesystem": "ext4",
                    "k8sStorageClassName": "default-storage-class-1",
                    "vcdStorageProfileName": "Development2",
                    "useDeleteReclaimPolicy": true
                }
            },
            "yamlSet": ["apiVersion: v1\nkind: Namespace\nmetadata:\n  name: vcd-ds-system\n  labels:\n    vcd-ds/installation-manifest: \"true\"\n",
                        "\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: vcd-ds-workloads\n  labels:\n    vcd-ds/installation-manifest: \"true\"\n", ...],
            "capiYaml": "..."
        }
        ...
    }
}

1.3 Remove all resources labled with vcd-ds/installation-manifest: "true" from the YamlSet

The YamlSet section in the API response payload contains all custom resources applying to the target TKGm clusters. The content in YamlSet is actually a YAML document with escaped strings. Please remove all resource items with the able vcd-ds/installation-manifest: "true". Please don't change other parts of the YAML. After the change, please make an API call PUT /cloudapi/1.0.0/entities/urn:vcloud:entity:vmware:capvcdCluster:<CAP_VCD_CLUSTER_UUID> with the Kubernetes cluster owner's JWT user token. The Etag value from last response must be set to the request header of the PUT method.

The API request is as below.
PUT /cloudapi/1.0.0/entities/urn:vcloud:entity:vmware:capvcdCluster:<CAP_VCD_CLUSTER_UUID> HTTP/1.1
Host: <vcd-rest-endpoint>
Authorization: Bearer <k8s-owner-jwt-token>
If-Match: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=--gzip
Content-Type: application/json
Accept: application/json;version=37.0

{
    "id": "urn:vcloud:entity:vmware:capvcdCluster:<CAP_VCD_CLUSTER_UUID>",
    "entityType": "urn:vcloud:type:vmware:capvcdCluster:1.1.0",
    "name": "small2",
    "externalId": "urn:vcloud:vapp:<VAPP_UUID>",
    "entity": {
        "kind": "CAPVCDCluster",
        "spec": {
            "vcdKe": {
                "isVCDKECluster": true,
                "autoRepairOnErrors": true,
                "defaultStorageClassOptions": {
                    "filesystem": "ext4",
                    "k8sStorageClassName": "default-storage-class-1",
                    "vcdStorageProfileName": "Development2",
                    "useDeleteReclaimPolicy": true
                }
            },
            "yamlSet": [],
            "capiYaml": "..."
        }
        ...
    }
}

2. Remove all PackageInstalls before you delete the namespace
In a terminal which has access to your TKGm cluster by Kubectl command, run below commands.
kubectl delete pkgi vcd-data-solutions-install -n vcd-ds-system
kubectl delete pkgi vcd-ds-rabbitmq-install -n vcd-ds-system

3.  Remove cluster scope resources and namespaces
In a terminal which has access to your TKGm cluster by Kubectl command, run below commands.
kubectl delete clusterrolebinding vcd-data-solutions-install
kubectl delete clusterrole vcd-data-solutions-install
kubectl delete clusterrolebinding -l app.kubernetes.io/created-by=vcd-ds
kubectl delete clusterrole -l app.kubernetes.io/created-by=vcd-ds
kubectl delete cm -n tanzu-system-dashboards -l app.kubernetes.io/created-by=vcd-ds
kubectl delete ns vcd-ds-workloads
kubectl delete ns vcd-ds-system


Additional Information

In addition to the current KB, you can use the VMware Cloud Director extension for Data Solutions documentation set at VMware Cloud Director extension for VMware Data Solutions Documentation.