Skip to content

Commit e3a4e8e

Browse files
committed
KubeVirt CSI driver and KubeVirt CSI Driver infra add-on updated with the changes enabling VolumeExpansion
1 parent 2290aa6 commit e3a4e8e

33 files changed

+2206
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Kubevirt CSI driver
2+
3+
The Kubevirt CSI driver is made for a guest cluster deployed on top of Spectro Cloud Palette VMO, and enables it to provision Persistent Volumes from the host VMO cluster. This CSI driver is deployed on the guest cluster. It will contact the host VMO cluster to orchestrate the hot-plugging of disks to VMs running the guest cluster, which will appear as PVCs inside Kubernetes.
4+
5+
![image](https://github.com/kubevirt/csi-driver/raw/main/docs/high-level-diagram.svg)
6+
7+
8+
## Prerequisites
9+
10+
- A host Palette VMO cluster.
11+
- A guest Kubernetes cluster deployed with VMO VMs, using Palette Agent Mode.
12+
- Palette Agent mode must be configured to set the hostname of the OS to match the name of the VM (using the `NAME` tag, see Usage section).
13+
14+
15+
## Parameters
16+
17+
To deploy the Kubevirt CSI Driver pack, you need to set at least the following parameters in the pack's YAML.
18+
19+
| Name | Description | Type | Default Value | Required |
20+
| --- | --- | --- | --- | --- |
21+
| `deployment.driver.infraClusterNamespace` | The namespace in the host VMO cluster in which the VMs for this guest cluster run | String | virtual-machines | Yes |
22+
| `deployment.infraClusterKubeconfig.k8sAPIendpoint` | The Kubernetes API endpoint of the host VMO cluster | String | `https://vmo-cluster.company.local:6443` | Yes |
23+
| `deployment.infraClusterKubeconfig.token` | Base64-encoded token from the kubevirt-csi-secret secret in the namespace where the VMs are running in the host VMO cluster | String | - | Yes |
24+
| `storageClasses[*].infraStorageClassName` | Name of the storageclass in the host VMO cluster that this storageclass should link to | String | spectro-storage-class | Yes |
25+
26+
27+
Review the [README](https://github.com/kubevirt/csi-driver/blob/main/README.md) for more details.
28+
29+
## Upgrade
30+
31+
To update the Kubevirt CSI Driver, deploy a newer version of the pack.
32+
33+
34+
## Usage
35+
36+
To use the Kubevirt CSI Driver pack, first create a new [add-on cluster profile](https://docs.spectrocloud.com/profiles/cluster-profiles/create-cluster-profiles/create-addon-profile/), Click "Add New Pack" and search for the **Kubevirt CSI Driver** pack in the Palete Community Registry.
37+
38+
Then we need to configure the sections in the pack YAML:
39+
* The `deployment.driver.infraClusterNamespace` parameter needs to match the namespace in the host VMO cluster that the VMs of the guest cluster will be running in.
40+
* The `deployment.infraClusterKubeconfig` section requires preparation on the host VMO cluster. The administrator of the host VMO cluster needs to first deploy the "Kubevirt CSI Driver Infra add-on" pack to the host VMO cluster. In that pack, the namespace you want to use in this pack needs to be included.
41+
* The `deployment.infraClusterKubeconfig.k8sAPIendpoint` parameter can be retrieved from the "Overview" tab of the host VMO cluster in Palette. Use the value of the "Kubernetes API" field on that tab.
42+
* The `deployment.infraClusterKubeconfig.token` parameter can be retrieved by the administrator of the host VMO cluster after applying the "Kubevirt CSI Driver Infra add-on" pack to the host VMO cluster. The administrator can run the following command to retrieve the token:
43+
```bash
44+
kubectl get secret kubevirt-csi-secret -n <namespace> -o json | jq .data.token
45+
```
46+
* The output of the command will be a base64-encoded string. Put that string as-is into the `deployment.infraClusterKubeconfig.token` parameter.
47+
* Finally, review the `deployment.storageClasses` section. Typically, the host VMO cluster will have 1 storageclass for virtual machines and the name of that storageclass depends on the type of storage used in the VMO cluster. The administrator of the host VMO cluster can provide the correct name for this storageclass. Enter that name in the `parameters.infraStorageClassName` section of the example "kubevirt" storageclass.
48+
49+
### VM deployment
50+
Once you have configured the pack, you can deploy it to a cluster. Note that you must use Palette Agent-mode clusters for this, and use specific preparation to set up the Agent-mode VMs. The hostname in the OS of each VM must match the name of the VM inside VMO. In order to automate this, we can set the `name` tag during registration of the VM. The following userdata for the VM can be used to automatically configure and register the VM with Palette as an agent-mode edge host, including the correct `name` tag:
51+
```
52+
#cloud-config
53+
ssh_pwauth: True
54+
chpasswd: { expire: False }
55+
password: spectro
56+
disable_root: false
57+
packages:
58+
- jq
59+
- conntrack
60+
write_files:
61+
- path: /tmp/user-data
62+
owner: 'root:root'
63+
permissions: '0755'
64+
content: |
65+
#cloud-config
66+
install:
67+
reboot: true
68+
poweroff: false
69+
stylus:
70+
site:
71+
edgeHostToken: [registration token here]
72+
paletteEndpoint: api.console.spectrocloud.com
73+
tags:
74+
name: %NAME%
75+
runcmd:
76+
- |
77+
mkdir -p /system/oem; mkdir -p /oem; mkdir -p /usr/local/cloud-config; mkdir -p /opt/spectrocloud/state
78+
curl --location --output /tmp/palette-agent-install.sh https://github.com/spectrocloud/agent-mode/releases/latest/download/palette-agent-install.sh
79+
chmod +x /tmp/palette-agent-install.sh
80+
export USERDATA=/tmp/user-data
81+
sed -i "s/%NAME%/$(hostname)/" /tmp/user-data
82+
sudo --preserve-env /tmp/palette-agent-install.sh
83+
```
84+
85+
### Snapshot support
86+
In order to use this CSI for snapshots, the following `VolumeSnapshotClass` can be created (manually, not part of this pack), through deploying the Volume Snapshot Controller pack:
87+
```
88+
apiVersion: snapshot.storage.k8s.io/v1
89+
kind: VolumeSnapshotClass
90+
metadata:
91+
name: kubevirt-csi-snapclass
92+
driver: csi.kubevirt.io
93+
deletionPolicy: Delete
94+
```
95+
96+
In the default pack configuration, the VolumeSnapshotClass in the guest cluster will be mapped to the default VolumeSnapshotClass in the host VMO cluster (assuming that VolumeSnapshotClass in the host VMO cluster contains the `snapshot.storage.kubernetes.io/is-default-class: "true"` annotation). If there is no default VolumeSnapshotClass in the host VMO cluster, or if multiple exist, a mapping can be configured in the `deployment.driver.infraStorageClassEnforcement` section of the pack. Review the information [here](https://github.com/kubevirt/csi-driver/blob/main/docs/snapshot-driver-config.md) on how to map VolumeSnapshotClasses to those in the host VMO cluster.
97+
98+
## References
99+
100+
- [Kubevirt CSI driver Github](https://github.com/kubevirt/csi-driver)
101+
- [Storage classes and Snapshot classes mapping](https://github.com/kubevirt/csi-driver/blob/main/docs/snapshot-driver-config.md)
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v2
2+
name: kubevirt-csi-driver
3+
description: Installs Kubevirt CSI Driver
4+
# A chart can be either an 'application' or a 'library' chart.
5+
#
6+
# Application charts are a collection of templates that can be packaged into versioned archives
7+
# to be deployed.
8+
#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
14+
# This is the chart version. This version number should be incremented each time you make changes
15+
# to the chart and its templates, including the app version.
16+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
17+
version: 1.0.2
18+
19+
# This is the version number of the application being deployed. This version number should be
20+
# incremented each time you make changes to the application. Versions are not expected to
21+
# follow Semantic Versioning. They should reflect the version the application is using.
22+
# It is recommended to use it with quotes.
23+
appVersion: "1.0.2"

0 commit comments

Comments
 (0)