From a2d2659cf3e006d11932f9d1cec911c1845a6e1e Mon Sep 17 00:00:00 2001 From: Piotr Zaniewski Date: Mon, 16 Dec 2024 11:32:45 +0100 Subject: [PATCH 1/5] feat: platform uninstall command - adding the new platform destroy command - reorganizing and improving the section - helm uninstall method is left the same Signed-off-by: Piotr Zaniewski --- .../config/vocabularies/Loft/accept.txt | 3 +- platform/how-to/uninstall.mdx | 87 +++++++++++++++---- 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/.github/styles/config/vocabularies/Loft/accept.txt b/.github/styles/config/vocabularies/Loft/accept.txt index b8fef75e0..2c59ce0bc 100644 --- a/.github/styles/config/vocabularies/Loft/accept.txt +++ b/.github/styles/config/vocabularies/Loft/accept.txt @@ -11,4 +11,5 @@ AWS [Ee][Kk][Ss] GKE GCP -AKS \ No newline at end of file +AKS +CRD \ No newline at end of file diff --git a/platform/how-to/uninstall.mdx b/platform/how-to/uninstall.mdx index d62b2482a..665bc69c9 100644 --- a/platform/how-to/uninstall.mdx +++ b/platform/how-to/uninstall.mdx @@ -2,40 +2,95 @@ 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 + + + +## Uninstall + +There are two ways to uninstall the platform. + + + + + +### Delete the platform + +Note that the +[VirtualClusterInstances](/platform/api/resources/virtualclusterinstance) +CDRs 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 ``` -Please make sure you also uninstall kiosk, if you have connected the loft cluster: +:::info +The command does the following: +- Uninstalls Helm releases related to Loft. +- Deletes CustomResourceDefinitions (CRDs). +- Optionally deletes when the `--delete-namespace` flag is provided. +- Removes default cluster roles and cluster role bindings. +::: -```bash -helm delete -n vcluster-platform loft-agent + + + +### Delete Helm release + +```bash title="Delete the platform Helm release" +helm delete -n vcluster-platform loft ``` -## Delete Namespace (optional) +Ensure you also uninstall kiosk if you have connected the loft cluster: -```bash -kubectl delete ns vcluster-platform +```bash title="Delete the Kiosk Helm release" +helm delete -n vcluster-platform loft-agent ``` -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) + +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: -```bash -# vCluster Platform agent api service and webhook +```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. ::: + + + + + +## Troubleshooting + +If a resource is stuck or encounters an error during deletion, refer to the +[troubleshooting](/platform/use-platform/troubleshooting) +section for assistance. From b797788f0067c557a92c885698d7477c975bde6d Mon Sep 17 00:00:00 2001 From: Piotr Zaniewski Date: Mon, 16 Dec 2024 15:18:18 +0100 Subject: [PATCH 2/5] chore: address PR feedback Signed-off-by: Piotr Zaniewski --- platform/how-to/uninstall.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/how-to/uninstall.mdx b/platform/how-to/uninstall.mdx index 665bc69c9..65a04ea30 100644 --- a/platform/how-to/uninstall.mdx +++ b/platform/how-to/uninstall.mdx @@ -28,7 +28,7 @@ There are two ways to uninstall the platform. - + ### Delete the platform @@ -60,9 +60,9 @@ The command does the following: helm delete -n vcluster-platform loft ``` -Ensure you also uninstall kiosk if you have connected the loft cluster: +Ensure you also uninstall the platform agent if you have connected the loft cluster: -```bash title="Delete the Kiosk Helm release" +```bash title="Delete the loft-agent Helm release" helm delete -n vcluster-platform loft-agent ``` From 423ea81271cc2b03998044462b8f10eb5dca7503 Mon Sep 17 00:00:00 2001 From: Piotr Zaniewski Date: Wed, 18 Dec 2024 16:56:19 +0100 Subject: [PATCH 3/5] chore: update versionBadge Version badge supports now independent versions: - vclusterVersion - platformVersion - both Signed-off-by: Piotr Zaniewski --- src/components/VersionBadge/index.js | 40 +++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/components/VersionBadge/index.js b/src/components/VersionBadge/index.js index 1c8f71ee8..793902d4a 100644 --- a/src/components/VersionBadge/index.js +++ b/src/components/VersionBadge/index.js @@ -1,15 +1,29 @@ 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 ( - This feature is available from version - {version} + {platformVersion && ( + <> + This feature is available from the platform version + {platformVersion} + + )} + {platformVersion && vclusterVersion && and } {vclusterVersion && ( <> - and was introduced in vCluster version + + {!platformVersion && 'This feature '}was introduced in vCluster version{' '} + {vclusterVersion} )} @@ -17,4 +31,22 @@ const VersionBadge = ({ version, vclusterVersion }) => { ); }; +// 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; \ No newline at end of file From d7deed32458afca821d435ab7c4de637046b25f6 Mon Sep 17 00:00:00 2001 From: Piotr Zaniewski Date: Wed, 18 Dec 2024 16:57:19 +0100 Subject: [PATCH 4/5] fix: versionBadge usage after update Signed-off-by: Piotr Zaniewski --- platform/administer/connector/database.mdx | 2 +- platform/configure/cost-control.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/administer/connector/database.mdx b/platform/administer/connector/database.mdx index 9ea970e18..572fda576 100644 --- a/platform/administer/connector/database.mdx +++ b/platform/administer/connector/database.mdx @@ -11,7 +11,7 @@ import InstallNextSteps from '../../_partials/install/install-next-steps.mdx'; import VersionBadge from '@site/src/components/VersionBadge'; - + 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). diff --git a/platform/configure/cost-control.mdx b/platform/configure/cost-control.mdx index ffcae3e7d..1b0bc4349 100644 --- a/platform/configure/cost-control.mdx +++ b/platform/configure/cost-control.mdx @@ -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. - + To track allocations and calculate savings for workloads running inside virtual clusters the platform deploys and manages [Prometheus](https://prometheus.io/) and From ab54817f5e9e5e783aab9fb34b733f4ea3343d93 Mon Sep 17 00:00:00 2001 From: Piotr Zaniewski Date: Wed, 18 Dec 2024 17:02:26 +0100 Subject: [PATCH 5/5] chore: address PR feedback Signed-off-by: Piotr Zaniewski --- platform/how-to/uninstall.mdx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/platform/how-to/uninstall.mdx b/platform/how-to/uninstall.mdx index 65a04ea30..a22ecfab4 100644 --- a/platform/how-to/uninstall.mdx +++ b/platform/how-to/uninstall.mdx @@ -28,13 +28,13 @@ There are two ways to uninstall the platform. - + ### Delete the platform Note that the [VirtualClusterInstances](/platform/api/resources/virtualclusterinstance) -CDRs managed with driver Helm are deleted, but the underlying virtual clusters +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: @@ -46,9 +46,9 @@ vcluster destroy platform :::info The command does the following: - Uninstalls Helm releases related to Loft. -- Deletes CustomResourceDefinitions (CRDs). -- Optionally deletes when the `--delete-namespace` flag is provided. -- Removes default cluster roles and cluster role bindings. +- 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. ::: @@ -60,12 +60,6 @@ The command does the following: helm delete -n vcluster-platform loft ``` -Ensure you also uninstall the platform agent if you have connected the loft cluster: - -```bash title="Delete the loft-agent Helm release" -helm delete -n vcluster-platform loft-agent -``` - ### Delete namespace (optional) 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: