Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: platform uninstall command #390

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/styles/config/vocabularies/Loft/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ AWS
[Ee][Kk][Ss]
GKE
GCP
AKS
AKS
CRD
2 changes: 1 addition & 1 deletion platform/administer/connector/database.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import InstallNextSteps from '../../_partials/install/install-next-steps.mdx';

import VersionBadge from '@site/src/components/VersionBadge';

<VersionBadge version="v4.1.0" vclusterVersion="v0.21.0"/>
<VersionBadge platformVersion="v4.1.0" vclusterVersion="v0.21.0"/>

The database connector feature allows an admin to configure a database server to manage backing stores for multiple virtual clusters. For each virtual cluster, the feature automatically creates an independent database and non-privileged user. Read more about the use of external databases in the [External Database documentation](/docs/vcluster/configure/vcluster-yaml/control-plane/components/backing-store/database/external).

Expand Down
2 changes: 1 addition & 1 deletion platform/configure/cost-control.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import VersionBadge from '@site/src/components/VersionBadge';

The platform comes with the cost control dashboard enabled by default, offering insights into potential [cost savings](https://www.vcluster.com/cost-savings) through virtual clusters.

<VersionBadge version="v4.2.0" vclusterVersion="v0.22.0"/>
<VersionBadge platformVersion="v4.2.0" vclusterVersion="v0.22.0"/>

To track allocations and calculate savings for workloads running inside
virtual clusters the platform deploys and manages [Prometheus](https://prometheus.io/) and
Expand Down
83 changes: 66 additions & 17 deletions platform/how-to/uninstall.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,89 @@
title: Uninstall vCluster Platform
sidebar_label: Uninstall vCluster Platform
sidebar_position: 8
description: Learn how to uninstall the vCluster Platform from your Kubernetes cluster using the vCluster CLI or Helm.
---

## Delete Helm Release
import VersionBadge from "@site/src/components/VersionBadge";
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

```bash
helm delete -n vcluster-platform loft
```
import Prerequisites from '../_partials/install/base-prerequisites.mdx';


This guide provides instructions on how to uninstall the platform from your Kubernetes cluster.

:::warning
This action is performed against the cluster the kube-context is pointing to, not the platform instance that is logged in. It does not require logging in to the platform.
:::

## Prerequisites

<Prerequisites />

## Uninstall

There are two ways to uninstall the platform.

<Tabs>
<TabItem value="Using vCluster CLI">
<VersionBadge vclusterVersion="v0.22" />

Please make sure you also uninstall kiosk, if you have connected the loft cluster:
### Delete the platform

```bash
helm delete -n vcluster-platform loft-agent
Note that the
[VirtualClusterInstances](/platform/api/resources/virtualclusterinstance)
CRDs managed with driver Helm are deleted, but the underlying virtual clusters
are not uninstalled.

On the Kubernetes cluster where the platform is installed, and all connected clusters, run:

```bash title="Delete the platform using vCluster CLI"
vcluster destroy platform
```

## Delete Namespace (optional)
:::info
The command does the following:
- Uninstalls Helm releases related to Loft.
- Deletes CustomResourceDefinitions (CRDs) created by the platform.
- Optionally deletes the namespace where the platform is installed when the `--delete-namespace` flag is provided.
- Removes cluster roles and cluster role bindings created by the platform.
:::

</TabItem>
<TabItem value="Using Helm">

### Delete Helm release

```bash
kubectl delete ns vcluster-platform
```bash title="Delete the platform Helm release"
helm delete -n vcluster-platform loft
```

If you have deleted the namespace **without** deleting the vcluster-platform and loft-agent helm releases beforehand, please make sure the api-services and webhooks are deleted correctly:
### Delete namespace (optional)

```bash
# vCluster Platform agent api service and webhook
Deleting the namespace ensures that all resources associated with the platform are removed. If you have deleted the namespace **without** deleting the vcluster-platform and loft-agent Helm releases beforehand, ensure the api-services and webhooks are deleted correctly:
Piotr1215 marked this conversation as resolved.
Show resolved Hide resolved

```bash title="Delete API service and webhook"
kubectl delete apiservice v1.cluster.loft.sh
kubectl delete validatingwebhookconfiguration loft-agent
```

## Delete CRDs (optional)
### Delete CRDs (optional)

```bash
```bash title="Delete platform CRDs"
kubectl api-resources --api-group='storage.loft.sh' -o name | xargs kubectl delete crd
```

:::warning Data Loss
Deleting the vCluster Platform CRDs will also remove all vCluster Platform objects inside your cluster, e.g. `Cluster`, `Team`, and `User`. This **cannot** be undone.
:::warning
Deleting the platform CRDs will also remove all platform objects inside your cluster, such as Cluster, Team, and User. This action cannot be undone.
:::

</TabItem>

</Tabs>

## Troubleshooting

If a resource is stuck or encounters an error during deletion, refer to the
[troubleshooting](/platform/use-platform/troubleshooting)
section for assistance.
40 changes: 36 additions & 4 deletions src/components/VersionBadge/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
import React from 'react';
import PropTypes from 'prop-types';
import Admonition from '@theme/Admonition';
import styles from './version-badge.module.css';

const VersionBadge = ({ version, vclusterVersion }) => {
const VersionBadge = ({ platformVersion, vclusterVersion }) => {
// Validation check - at least one version must be provided
if (!platformVersion && !vclusterVersion) {
console.error('VersionBadge: Either platformVersion or vclusterVersion must be provided');
return null;
}

return (
<Admonition type="info">
<span>This feature is available from version </span>
<span className={styles.versionBadge}>{version}</span>
{platformVersion && (
<>
<span>This feature is available from the <strong>platform</strong> version </span>
<span className={styles.versionBadge}>{platformVersion}</span>
</>
)}
{platformVersion && vclusterVersion && <span> and </span>}
{vclusterVersion && (
<>
<span> and was introduced in <strong>vCluster</strong> version </span>
<span>
{!platformVersion && 'This feature '}was introduced in <strong>vCluster</strong> version{' '}
</span>
<span className={styles.versionBadge}>{vclusterVersion}</span>
</>
)}
</Admonition>
);
};

// Prop validation
VersionBadge.propTypes = {
platformVersion: function(props, propName, componentName) {
if (!props.platformVersion && !props.vclusterVersion) {
return new Error(
`Either 'platformVersion' or 'vclusterVersion' must be provided in '${componentName}'`
);
}
},
vclusterVersion: function(props, propName, componentName) {
if (!props.platformVersion && !props.vclusterVersion) {
return new Error(
`Either 'platformVersion' or 'vclusterVersion' must be provided in '${componentName}'`
);
}
}
};

export default VersionBadge;
Loading