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(migration): vcluster helm values comparison #444

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
539 changes: 539 additions & 0 deletions docs/_partials/0-20.migration.mdx

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/components/Column/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
// Import clsx library for conditional classes.
import clsx from 'clsx';

// Define the Column component as a function
// with children, className, style as properties
// Look https://infima.dev/docs/ for learn more
// Style only affects the element inside the column, but we could have also made the same distinction as for the classes.
export default function Column({ children , className, style }) {
return (

<div className={clsx('col' , className)} style={style}>
{children}
</div>

);
}
17 changes: 17 additions & 0 deletions src/components/Columns/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
// Import clsx library for conditional classes.
import clsx from 'clsx';
// Define the Columns component as a function
// with children, className, and style as properties
// className will allow you to pass either your custom classes or the native infima classes https://infima.dev/docs/layout/grid.
// Style" will allow you to either pass your custom styles directly, which can be an alternative to the "styles.module.css" file in certain cases.
export default function Columns({ children , className , style }) {
return (
// This section encompasses the columns that we will integrate with children from a dedicated component to allow the addition of columns as needed
<div className="container center">
<div className={clsx('row', className)} style={style}>
{children}
</div>
</div>
);
}
11 changes: 11 additions & 0 deletions src/theme/MDXComponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
// Importing the original mapper + our components according to the Docusaurus doc
import MDXComponents from '@theme-original/MDXComponents';
import Columns from '@site/src/components/Columns';
import Column from '@site/src/components/Column';
export default {
// Reusing the default mapping
...MDXComponents,
Columns,
Column,
};
181 changes: 2 additions & 179 deletions vcluster/reference/migrations/0-20-migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,183 +4,6 @@ description: How to migrate from pre-v0.20 to v0.20 release.
sidebar_position: 2
---

import DeployChanges from '../../_partials/manage/deploy-changes.mdx'
import MigrationGuide from '@site/docs/_partials/0-20.migration.mdx';


As part of the v0.20.0 release, Loft Labs introduced a new `vcluster.yaml` configuration file with a new structure. This file replaces your existing `values.yaml` configuration file. Previously, configuring
a virtual cluster had configuration options using CLI flags, anontations and different `values.yaml` options. With the new `vcluster.yaml`, all configuration options are now easily configured in a single source.

<p></p>

:::warning
Pre-v0.20.0 `values.yaml` files are not compatible with v0.20.0. You need to convert to the new format in order to use the new vCluster CLI and upgrade existing vCluster instances.
:::


Upgrade vCluster v0.19 to v0.20+ by following these steps:

1. [Upgrade the vCluster CLI](#upgrade-the-cli).
1. [Convert your Helm values configuration file to the new `vcluster.yaml` configuration file](#convert-your-valuesyaml-to-vclusteryaml).
1. [Use your new `vcluster.yaml` file to upgrade your vCluster instance](#upgrade-your-vcluster-instance).

## Supported legacy versions

Loft Labs has tested the conversion path from v0.19.x to v0.20.0 and therefore recommends moving to v0.19.x before converting to v0.20.0.

Conversions from vCluster versions prior to 0.19.x might work but have not been tested extensively.

## Before you begin

* Helm version is >= v.3.10.0.
* Upgrade [vcluster-hostpath-mapper](https://github.com/loft-sh/vcluster-hostpath-mapper) to v0.1.1-beta.1 or later for use with the new vcluster.yaml configuration file in v0.20.
* Review the [list of changes](../../cli/0-20-cli-changes/) in the vCluster CLI as commands, subcommands, and flags were removed, renamed or added.


## Upgrade the CLI

Before upgrading virtual cluster instances, upgrade to the latest version of the vCluster CLI.

```BASH
vcluster upgrade --version <VCLUSTER_VERSION>
```

Replace:

- `<VCLUSTER_VERSION>` with the version of vCluster you want to upgrade to.



A new command has been added to support converting from the old `values.yaml` format to the new `vcluster.yaml`.

```BASH
Usage:
vcluster convert config [flags]
Flags:
--distro string Kubernetes distro used
-f, --file string Path to the input file
-h, --help Help for config
-o, --output string Prints the output in the specified format. Allowed values: yaml, json (default "yaml")
```

## Get your previous `values.yaml` (Optional)

If you have the existing `values.yaml` that you provided to your existing vCluster, you can skip this step.

### Get the User-Suppied Values

If you don't have the `values.yaml`, use Helm to retrieve the user defined configuration for your currently running virtual cluster.

```bash
helm get values <VCLUSTER_NAME> -n <VCLUSTER_NAMESPACE> > values.yaml
```

Replace:

- `<VCLUSTER_NAME>` with the name of your vCluster instance.
- `<VCLUSTER_NAMESPACE>` with the namespace that vCluster runs in.

This uses `--revision 0` under the hood. Adjust this accordingly to receive the values of your latest revision. See the [Helm docs](https://helm.sh/docs/helm/helm_history/) for how to fetch revision history.

### Get the Default Values

If the `helm get` provides an empty file, then you used the default configuration to deploy your vCluster. You will still need to
supply a `values.yaml` to the convert due to changes in defaults.

```bash
helm get values <VCLUSTER_NAME> -n <VCLUSTER_NAMESPACE> --all > values.yaml
```

Replace:

- `<VCLUSTER_NAME>` with the name of your vCluster instance.
- `<VCLUSTER_NAMESPACE>` with the namespace that vCluster runs in.


## Convert your `values.yaml` to `vcluster.yaml`

Convert your `values.yaml` to the new `vcluster.yaml` configuration file format by running:

```BASH
vcluster convert config --distro <KUBERNETES_DISTRO> -f <VALUES_FILE> > vcluster.yaml
```

Replace:

- `<KUBERNETES_DISTRO>` with your virtual cluster's existing Kubernetes distribution. **You can't change the Kubernetes distribution or backing store during an upgrade**.
- `<VALUES_FILE>` with the path to the `values.yaml`file you used to configure your pre-v0.20 vCluster instance.


For example:

```BASH
vcluster convert config --distro k8s -f /my/k8s/values.yaml > vcluster.yaml
```

### Notes about Changes for your `vcluster.yaml`

#### Scheduling of the StatefulSet
Since the scheduling of the control plane pod changed in v0.20, the converted `vcluster.yaml` will include retaining
the original scheduling pattern as it is can't be changed between upgrades.

#### Image Repository
By default, the conversion will not set the repo of the images to use the open source repo, but upgrade you to use
the vCluster Pro repo. This allows users to seamlessly test and adopt any vCluster Pro feature without disrupting their existing
open-source functionality. The Pro features are integrated into the Pro image but remain inactive by default to ensure that your experience remains consistent with the open-source version unless you specifically activate Pro features.

If you want to continue using the open-source image, you will need to explicitly set the open source repository for your images.

```yaml
controlPlane:
statefulSet:
image:
repository: loft-sh/vcluster-oss
```

#### Supporting EKS Distributions

In v0.20, we have removed the support of EKS as a virtual cluster distribution. Reminder: The Kubernetes distribution of the virtual cluster doesn't need to match the the distribution of your host cluster. You can use any distribution of vCluster to deploy vCluster on EKS clusters.

In order to continue using your virtual clusters that have EKS as the distribution, you can convert to using the k8s distribution and replace the images with the EKS images. While this was tested when v0.20.0 was released, it is not continuously tested. We recommend spinning up new virtual clusters with the k8s distribution and migrate your workloads to them.

```bash
vcluster convert config --distro k8s -f /my/k8s/values.yaml > vcluster.yaml
```

After the conversion, you will need to update the `vcluster.yaml` and change the images to be used. Refer to the EKS registries for [kube-apiserver](https://gallery.ecr.aws/eks-distro/kubernetes/kube-apiserver), [controller-manager](https://gallery.ecr.aws/eks-distro/kubernetes/kube-controller-manager) and [kube-scheduler](https://gallery.ecr.aws/eks-distro/kubernetes/kube-scheduler) for the specific tags you might want to use.

**Example using EKS v1.30:**

```yaml
controlplane:
distro:
k8s:
enabled: true
apiserver:
image:
registry: "public.ecr.aws"
repository: "eks-distro/kubernetes/kube-apiserver"
tag: "v1.30.2-eks-1-30-10"
controllerManager:
image:
registry: "public.ecr.aws"
repository: "eks-distro/kubernetes/kube-controller-manager"
tag: "v1.30.2-eks-1-30-10"
scheduler:
image:
registry: "public.ecr.aws"
repository: "eks-distro/kubernetes/kube-scheduler"
tag: "v1.30.2-eks-1-30-10"
```

## Upgrade your vCluster instance

:::warning Downgrading vCluster instances is NOT supported
While downgrading to an older version of the vCluster CLI is supported, you cannot downgrade virtual cluster instances to a prior version of vCluster (for example, from 0.20 back to 0.19). Make sure you have tested the upgrade sufficiently before rolling out this change to critical systems.
:::


<DeployChanges/>

## Related content

- [vCluster config reference](/vcluster/configure/vcluster-yaml/) for full configuration details.
<MigrationGuide />
Loading