From cad9cdedf5be97904e778629ccaafb590c9d7d4e Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Thu, 17 Oct 2024 14:52:48 +0200 Subject: [PATCH] Add Virtual Machine (simple) (#430) Revert removing Virtual Machine, removed by https://github.com/aenix-io/cozystack/pull/403 ## Summary by CodeRabbit - **New Features** - Introduced a new package: `virtual-machine` with multiple version entries. - Added comprehensive documentation and configuration for the `virtual-machine` application. - New Helm chart and templates for Kubernetes resources, enhancing deployment options. - **Bug Fixes** - Updated version entries for existing packages, ensuring accuracy in versioning. Signed-off-by: Andrei Kvapil --- packages/apps/versions_map | 6 + packages/apps/virtual-machine/.helmignore | 3 + packages/apps/virtual-machine/Chart.yaml | 26 ++ packages/apps/virtual-machine/Makefile | 10 + packages/apps/virtual-machine/README.md | 268 ++++++++++++++++++ .../hack/update-instance-types.sh | 1 + packages/apps/virtual-machine/logos/vm.svg | 21 ++ .../virtual-machine/templates/_helpers.tpl | 51 ++++ .../virtual-machine/templates/secret.yaml | 21 ++ .../virtual-machine/templates/service.yaml | 21 ++ .../apps/virtual-machine/templates/vm.yaml | 108 +++++++ .../apps/virtual-machine/values.schema.json | 187 ++++++++++++ packages/apps/virtual-machine/values.yaml | 51 ++++ packages/extra/versions_map | 3 +- 14 files changed, 776 insertions(+), 1 deletion(-) create mode 100644 packages/apps/virtual-machine/.helmignore create mode 100644 packages/apps/virtual-machine/Chart.yaml create mode 100644 packages/apps/virtual-machine/Makefile create mode 100644 packages/apps/virtual-machine/README.md create mode 100755 packages/apps/virtual-machine/hack/update-instance-types.sh create mode 100644 packages/apps/virtual-machine/logos/vm.svg create mode 100644 packages/apps/virtual-machine/templates/_helpers.tpl create mode 100644 packages/apps/virtual-machine/templates/secret.yaml create mode 100644 packages/apps/virtual-machine/templates/service.yaml create mode 100644 packages/apps/virtual-machine/templates/vm.yaml create mode 100644 packages/apps/virtual-machine/values.schema.json create mode 100644 packages/apps/virtual-machine/values.yaml diff --git a/packages/apps/versions_map b/packages/apps/versions_map index 27fbc47c..bb341c42 100644 --- a/packages/apps/versions_map +++ b/packages/apps/versions_map @@ -77,6 +77,12 @@ tenant 1.3.0 ceefae03 tenant 1.3.1 c56e5769 tenant 1.4.0 94c688f7 tenant 1.5.0 HEAD +virtual-machine 0.1.4 f2015d6 +virtual-machine 0.1.5 7cd7de7 +virtual-machine 0.2.0 5ca8823 +virtual-machine 0.3.0 b908400 +virtual-machine 0.4.0 4746d51 +virtual-machine 0.5.0 HEAD vm-disk 0.1.0 HEAD vm-instance 0.1.0 HEAD vpn 0.1.0 f642698 diff --git a/packages/apps/virtual-machine/.helmignore b/packages/apps/virtual-machine/.helmignore new file mode 100644 index 00000000..1ea0ae84 --- /dev/null +++ b/packages/apps/virtual-machine/.helmignore @@ -0,0 +1,3 @@ +.helmignore +/logos +/Makefile diff --git a/packages/apps/virtual-machine/Chart.yaml b/packages/apps/virtual-machine/Chart.yaml new file mode 100644 index 00000000..40b76b04 --- /dev/null +++ b/packages/apps/virtual-machine/Chart.yaml @@ -0,0 +1,26 @@ +apiVersion: v2 +#name: Virtual Machine +name: virtual-machine +description: Virtual Machine (simple) +icon: /logos/vm.svg + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.5.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.1" diff --git a/packages/apps/virtual-machine/Makefile b/packages/apps/virtual-machine/Makefile new file mode 100644 index 00000000..31ae2f19 --- /dev/null +++ b/packages/apps/virtual-machine/Makefile @@ -0,0 +1,10 @@ +include ../../../scripts/package.mk + +generate: + readme-generator -v values.yaml -s values.schema.json -r README.md + INSTANCE_TYPES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/instancetypes.yaml | yq 'split(" ") | . + [""]' -o json) \ + && yq -i -o json ".properties.instanceType.optional=true | .properties.instanceType.enum = $${INSTANCE_TYPES}" values.schema.json + PREFERENCES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/preferences.yaml | yq 'split(" ") | . + [""]' -o json) \ + && yq -i -o json ".properties.instanceProfile.optional=true | .properties.instanceProfile.enum = $${PREFERENCES}" values.schema.json + yq -i -o json '.properties.externalPorts.items.type = "integer"' values.schema.json + yq -i -o json '.properties.systemDisk.properties.image.enum = ["ubuntu", "cirros", "alpine", "fedora", "talos"]' values.schema.json diff --git a/packages/apps/virtual-machine/README.md b/packages/apps/virtual-machine/README.md new file mode 100644 index 00000000..90bf3dc4 --- /dev/null +++ b/packages/apps/virtual-machine/README.md @@ -0,0 +1,268 @@ +# Virtual Machine (simple) + +A Virtual Machine (VM) simulates computer hardware, enabling various operating systems and applications to run in an isolated environment. + +## Deployment Details + +The virtual machine is managed and hosted through KubeVirt, allowing you to harness the benefits of virtualization within your Kubernetes ecosystem. + +- Docs: [KubeVirt User Guide](https://kubevirt.io/user-guide/) +- GitHub: [KubeVirt Repository](https://github.com/kubevirt/kubevirt) + +## Accessing virtual machine + +You can access the virtual machine using the virtctl tool: +- [KubeVirt User Guide - Virtctl Client Tool](https://kubevirt.io/user-guide/user_workloads/virtctl_client_tool/) + +To access the serial console: + +``` +virtctl console +``` + +To access the VM using VNC: + +``` +virtctl vnc +``` + +To SSH into the VM: + +``` +virtctl ssh @ +``` + +## Parameters + +### Common parameters + +| Name | Description | Value | +| ------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------- | +| `external` | Enable external access from outside the cluster | `false` | +| `externalPorts` | Specify ports to forward from outside the cluster | `[]` | +| `running` | Determines if the virtual machine should be running | `true` | +| `instanceType` | Virtual Machine instance type | `u1.medium` | +| `instanceProfile` | Virtual Machine prefferences profile | `ubuntu` | +| `systemDisk.image` | The base image for the virtual machine. Allowed values: `ubuntu`, `cirros`, `alpine`, `fedora` and `talos` | `ubuntu` | +| `systemDisk.storage` | The size of the disk allocated for the virtual machine | `5Gi` | +| `systemDisk.storageClass` | StorageClass used to store the data | `replicated` | +| `resources.cpu` | The number of CPU cores allocated to the virtual machine | `""` | +| `resources.memory` | The amount of memory allocated to the virtual machine | `""` | +| `sshKeys` | List of SSH public keys for authentication. Can be a single key or a list of keys. | `[]` | +| `cloudInit` | cloud-init user data config. See cloud-init documentation for more details. | `#cloud-config +` | + +## U Series + +The U Series is quite neutral and provides resources for +general purpose applications. + +*U* is the abbreviation for "Universal", hinting at the universal +attitude towards workloads. + +VMs of instance types will share physical CPU cores on a +time-slice basis with other VMs. + +### U Series Characteristics + +Specific characteristics of this series are: +- *Burstable CPU performance* - The workload has a baseline compute + performance but is permitted to burst beyond this baseline, if + excess compute resources are available. +- *vCPU-To-Memory Ratio (1:4)* - A vCPU-to-Memory ratio of 1:4, for less + noise per node. + +## O Series + +The O Series is based on the U Series, with the only difference +being that memory is overcommitted. + +*O* is the abbreviation for "Overcommitted". + +### UO Series Characteristics + +Specific characteristics of this series are: +- *Burstable CPU performance* - The workload has a baseline compute + performance but is permitted to burst beyond this baseline, if + excess compute resources are available. +- *Overcommitted Memory* - Memory is over-committed in order to achieve + a higher workload density. +- *vCPU-To-Memory Ratio (1:4)* - A vCPU-to-Memory ratio of 1:4, for less + noise per node. + +## CX Series + +The CX Series provides exclusive compute resources for compute +intensive applications. + +*CX* is the abbreviation of "Compute Exclusive". + +The exclusive resources are given to the compute threads of the +VM. In order to ensure this, some additional cores (depending +on the number of disks and NICs) will be requested to offload +the IO threading from cores dedicated to the workload. +In addition, in this series, the NUMA topology of the used +cores is provided to the VM. + +### CX Series Characteristics + +Specific characteristics of this series are: +- *Hugepages* - Hugepages are used in order to improve memory + performance. +- *Dedicated CPU* - Physical cores are exclusively assigned to every + vCPU in order to provide fixed and high compute guarantees to the + workload. +- *Isolated emulator threads* - Hypervisor emulator threads are isolated + from the vCPUs in order to reduce emaulation related impact on the + workload. +- *vNUMA* - Physical NUMA topology is reflected in the guest in order to + optimize guest sided cache utilization. +- *vCPU-To-Memory Ratio (1:2)* - A vCPU-to-Memory ratio of 1:2. + +## M Series + +The M Series provides resources for memory intensive +applications. + +*M* is the abbreviation of "Memory". + +### M Series Characteristics + +Specific characteristics of this series are: +- *Hugepages* - Hugepages are used in order to improve memory + performance. +- *Burstable CPU performance* - The workload has a baseline compute + performance but is permitted to burst beyond this baseline, if + excess compute resources are available. +- *vCPU-To-Memory Ratio (1:8)* - A vCPU-to-Memory ratio of 1:8, for much + less noise per node. + +## RT Series + +The RT Series provides resources for realtime applications, like Oslat. + +*RT* is the abbreviation for "realtime". + +This series of instance types requires nodes capable of running +realtime applications. + +### RT Series Characteristics + +Specific characteristics of this series are: +- *Hugepages* - Hugepages are used in order to improve memory + performance. +- *Dedicated CPU* - Physical cores are exclusively assigned to every + vCPU in order to provide fixed and high compute guarantees to the + workload. +- *Isolated emulator threads* - Hypervisor emulator threads are isolated + from the vCPUs in order to reduce emaulation related impact on the + workload. +- *vCPU-To-Memory Ratio (1:4)* - A vCPU-to-Memory ratio of 1:4 starting from + the medium size. + +## Development + +To get started with customizing or creating your own instancetypes and preferences +see [DEVELOPMENT.md](./DEVELOPMENT.md). + +## Resources + +The following instancetype resources are provided by Cozystack: + +Name | vCPUs | Memory +-----|-------|------- +cx1.2xlarge | 8 | 16Gi +cx1.4xlarge | 16 | 32Gi +cx1.8xlarge | 32 | 64Gi +cx1.large | 2 | 4Gi +cx1.medium | 1 | 2Gi +cx1.xlarge | 4 | 8Gi +gn1.2xlarge | 8 | 32Gi +gn1.4xlarge | 16 | 64Gi +gn1.8xlarge | 32 | 128Gi +gn1.xlarge | 4 | 16Gi +m1.2xlarge | 8 | 64Gi +m1.4xlarge | 16 | 128Gi +m1.8xlarge | 32 | 256Gi +m1.large | 2 | 16Gi +m1.xlarge | 4 | 32Gi +n1.2xlarge | 16 | 32Gi +n1.4xlarge | 32 | 64Gi +n1.8xlarge | 64 | 128Gi +n1.large | 4 | 8Gi +n1.medium | 4 | 4Gi +n1.xlarge | 8 | 16Gi +o1.2xlarge | 8 | 32Gi +o1.4xlarge | 16 | 64Gi +o1.8xlarge | 32 | 128Gi +o1.large | 2 | 8Gi +o1.medium | 1 | 4Gi +o1.micro | 1 | 1Gi +o1.nano | 1 | 512Mi +o1.small | 1 | 2Gi +o1.xlarge | 4 | 16Gi +rt1.2xlarge | 8 | 32Gi +rt1.4xlarge | 16 | 64Gi +rt1.8xlarge | 32 | 128Gi +rt1.large | 2 | 8Gi +rt1.medium | 1 | 4Gi +rt1.micro | 1 | 1Gi +rt1.small | 1 | 2Gi +rt1.xlarge | 4 | 16Gi +u1.2xlarge | 8 | 32Gi +u1.2xmedium | 2 | 4Gi +u1.4xlarge | 16 | 64Gi +u1.8xlarge | 32 | 128Gi +u1.large | 2 | 8Gi +u1.medium | 1 | 4Gi +u1.micro | 1 | 1Gi +u1.nano | 1 | 512Mi +u1.small | 1 | 2Gi +u1.xlarge | 4 | 16Gi + +The following preference resources are provided by Cozystack: + +Name | Guest OS +-----|--------- +alpine | Alpine +centos.7 | CentOS 7 +centos.7.desktop | CentOS 7 +centos.stream10 | CentOS Stream 10 +centos.stream10.desktop | CentOS Stream 10 +centos.stream8 | CentOS Stream 8 +centos.stream8.desktop | CentOS Stream 8 +centos.stream8.dpdk | CentOS Stream 8 +centos.stream9 | CentOS Stream 9 +centos.stream9.desktop | CentOS Stream 9 +centos.stream9.dpdk | CentOS Stream 9 +cirros | Cirros +fedora | Fedora (amd64) +fedora.arm64 | Fedora (arm64) +opensuse.leap | OpenSUSE Leap +opensuse.tumbleweed | OpenSUSE Tumbleweed +rhel.10 | Red Hat Enterprise Linux 10 Beta (amd64) +rhel.10.arm64 | Red Hat Enterprise Linux 10 Beta (arm64) +rhel.7 | Red Hat Enterprise Linux 7 +rhel.7.desktop | Red Hat Enterprise Linux 7 +rhel.8 | Red Hat Enterprise Linux 8 +rhel.8.desktop | Red Hat Enterprise Linux 8 +rhel.8.dpdk | Red Hat Enterprise Linux 8 +rhel.9 | Red Hat Enterprise Linux 9 (amd64) +rhel.9.arm64 | Red Hat Enterprise Linux 9 (arm64) +rhel.9.desktop | Red Hat Enterprise Linux 9 Desktop (amd64) +rhel.9.dpdk | Red Hat Enterprise Linux 9 DPDK (amd64) +rhel.9.realtime | Red Hat Enterprise Linux 9 Realtime (amd64) +sles | SUSE Linux Enterprise Server +ubuntu | Ubuntu +windows.10 | Microsoft Windows 10 +windows.10.virtio | Microsoft Windows 10 (virtio) +windows.11 | Microsoft Windows 11 +windows.11.virtio | Microsoft Windows 11 (virtio) +windows.2k16 | Microsoft Windows Server 2016 +windows.2k16.virtio | Microsoft Windows Server 2016 (virtio) +windows.2k19 | Microsoft Windows Server 2019 +windows.2k19.virtio | Microsoft Windows Server 2019 (virtio) +windows.2k22 | Microsoft Windows Server 2022 +windows.2k22.virtio | Microsoft Windows Server 2022 (virtio) +windows.2k25 | Microsoft Windows Server 2025 +windows.2k25.virtio | Microsoft Windows Server 2025 (virtio) diff --git a/packages/apps/virtual-machine/hack/update-instance-types.sh b/packages/apps/virtual-machine/hack/update-instance-types.sh new file mode 100755 index 00000000..1a248525 --- /dev/null +++ b/packages/apps/virtual-machine/hack/update-instance-types.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/packages/apps/virtual-machine/logos/vm.svg b/packages/apps/virtual-machine/logos/vm.svg new file mode 100644 index 00000000..9c3e34d9 --- /dev/null +++ b/packages/apps/virtual-machine/logos/vm.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/apps/virtual-machine/templates/_helpers.tpl b/packages/apps/virtual-machine/templates/_helpers.tpl new file mode 100644 index 00000000..671b8934 --- /dev/null +++ b/packages/apps/virtual-machine/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "virtual-machine.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "virtual-machine.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "virtual-machine.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "virtual-machine.labels" -}} +helm.sh/chart: {{ include "virtual-machine.chart" . }} +{{ include "virtual-machine.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "virtual-machine.selectorLabels" -}} +app.kubernetes.io/name: {{ include "virtual-machine.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/packages/apps/virtual-machine/templates/secret.yaml b/packages/apps/virtual-machine/templates/secret.yaml new file mode 100644 index 00000000..a92a7b6b --- /dev/null +++ b/packages/apps/virtual-machine/templates/secret.yaml @@ -0,0 +1,21 @@ +{{- if .Values.sshKeys }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "virtual-machine.fullname" $ }}-ssh-keys +stringData: + {{- range $k, $v := .Values.sshKeys }} + key{{ $k }}: {{ quote $v }} + {{- end }} +{{- end }} +{{- if .Values.cloudInit }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "virtual-machine.fullname" . }}-cloud-init +stringData: + userdata: | + {{- .Values.cloudInit | nindent 4 }} +{{- end }} diff --git a/packages/apps/virtual-machine/templates/service.yaml b/packages/apps/virtual-machine/templates/service.yaml new file mode 100644 index 00000000..9c1dc2aa --- /dev/null +++ b/packages/apps/virtual-machine/templates/service.yaml @@ -0,0 +1,21 @@ +{{- if .Values.external }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "virtual-machine.fullname" . }} + labels: + {{- include "virtual-machine.labels" . | nindent 4 }} +spec: + type: {{ ternary "LoadBalancer" "ClusterIP" .Values.external }} + externalTrafficPolicy: Local + allocateLoadBalancerNodePorts: false + selector: + {{- include "virtual-machine.labels" . | nindent 4 }} + ports: + {{- range .Values.externalPorts }} + - name: port-{{ . }} + port: {{ . }} + targetPort: {{ . }} + {{- end }} +{{- end }} diff --git a/packages/apps/virtual-machine/templates/vm.yaml b/packages/apps/virtual-machine/templates/vm.yaml new file mode 100644 index 00000000..d952483e --- /dev/null +++ b/packages/apps/virtual-machine/templates/vm.yaml @@ -0,0 +1,108 @@ +{{- if and .Values.instanceType (not (lookup "instancetype.kubevirt.io/v1beta1" "VirtualMachineClusterInstancetype" "" .Values.instanceType)) }} +{{- fail (printf "Specified instancetype not exists in cluster: %s" .Values.instanceType) }} +{{- end }} +{{- if and .Values.instanceProfile (not (lookup "instancetype.kubevirt.io/v1beta1" "VirtualMachineClusterPreference" "" .Values.instanceProfile)) }} +{{- fail (printf "Specified profile not exists in cluster: %s" .Values.instanceProfile) }} +{{- end }} + +apiVersion: kubevirt.io/v1 +kind: VirtualMachine +metadata: + name: {{ include "virtual-machine.fullname" . }} + labels: + {{- include "virtual-machine.labels" . | nindent 4 }} +spec: + running: {{ .Values.running | default "true" }} + {{- with .Values.instanceType }} + instancetype: + kind: VirtualMachineClusterInstancetype + name: {{ . }} + {{- end }} + {{- with .Values.instanceProfile }} + preference: + kind: VirtualMachineClusterPreference + name: {{ . }} + {{- end }} + dataVolumeTemplates: + - metadata: + name: {{ include "virtual-machine.fullname" . }} + spec: + pvc: + volumeMode: Block + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.systemDisk.storage | quote }} + {{- with .Values.systemDisk.storageClass }} + storageClassName: {{ . }} + {{- end }} + source: + http: + {{- if eq .Values.systemDisk.image "cirros" }} + url: https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img + {{- else if eq .Values.systemDisk.image "ubuntu" }} + url: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img + {{- else if eq .Values.systemDisk.image "fedora" }} + url: https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2 + {{- else if eq .Values.systemDisk.image "alpine" }} + url: https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/cloud/nocloud_alpine-3.20.2-x86_64-bios-tiny-r0.qcow2 + {{- else if eq .Values.systemDisk.image "talos" }} + url: https://github.com/siderolabs/talos/releases/download/v1.7.6/nocloud-amd64.raw.xz + {{- end }} + + template: + metadata: + annotations: + kubevirt.io/allow-pod-bridge-network-live-migration: "true" + labels: + {{- include "virtual-machine.labels" . | nindent 8 }} + spec: + domain: + {{- if and .Values.resources .Values.resources.cpu }} + cpu: + cores: {{ .Values.resources.cpu }} + {{- end }} + {{- if and .Values.resources .Values.resources.memory }} + resources: + requests: + memory: {{ .Values.resources.memory | quote }} + {{- end }} + devices: + disks: + - disk: + bus: scsi + name: systemdisk + {{- if or .Values.sshKeys .Values.cloudInit }} + - disk: + bus: virtio + name: cloudinitdisk + {{- end }} + interfaces: + - name: default + bridge: {} + machine: + type: "" + {{- with .Values.sshKeys }} + accessCredentials: + - sshPublicKey: + source: + secret: + secretName: {{ include "virtual-machine.fullname" $ }}-ssh-keys + propagationMethod: + noCloud: {} + {{- end }} + terminationGracePeriodSeconds: 30 + volumes: + - name: systemdisk + dataVolume: + name: {{ include "virtual-machine.fullname" . }} + {{- if or .Values.sshKeys .Values.cloudInit }} + - name: cloudinitdisk + cloudInitNoCloud: + secretRef: + name: {{ include "virtual-machine.fullname" . }}-cloud-init + {{- end }} + networks: + - name: default + pod: {} diff --git a/packages/apps/virtual-machine/values.schema.json b/packages/apps/virtual-machine/values.schema.json new file mode 100644 index 00000000..1192b2d8 --- /dev/null +++ b/packages/apps/virtual-machine/values.schema.json @@ -0,0 +1,187 @@ +{ + "title": "Chart Values", + "type": "object", + "properties": { + "external": { + "type": "boolean", + "description": "Enable external access from outside the cluster", + "default": false + }, + "externalPorts": { + "type": "array", + "description": "Specify ports to forward from outside the cluster", + "default": "[]", + "items": { + "type": "integer" + } + }, + "running": { + "type": "boolean", + "description": "Determines if the virtual machine should be running", + "default": true + }, + "instanceType": { + "type": "string", + "description": "Virtual Machine instance type", + "default": "u1.medium", + "optional": true, + "enum": [ + "cx1.2xlarge", + "cx1.4xlarge", + "cx1.8xlarge", + "cx1.large", + "cx1.medium", + "cx1.xlarge", + "gn1.2xlarge", + "gn1.4xlarge", + "gn1.8xlarge", + "gn1.xlarge", + "m1.2xlarge", + "m1.4xlarge", + "m1.8xlarge", + "m1.large", + "m1.xlarge", + "n1.2xlarge", + "n1.4xlarge", + "n1.8xlarge", + "n1.large", + "n1.medium", + "n1.xlarge", + "o1.2xlarge", + "o1.4xlarge", + "o1.8xlarge", + "o1.large", + "o1.medium", + "o1.micro", + "o1.nano", + "o1.small", + "o1.xlarge", + "rt1.2xlarge", + "rt1.4xlarge", + "rt1.8xlarge", + "rt1.large", + "rt1.medium", + "rt1.micro", + "rt1.small", + "rt1.xlarge", + "u1.2xlarge", + "u1.2xmedium", + "u1.4xlarge", + "u1.8xlarge", + "u1.large", + "u1.medium", + "u1.micro", + "u1.nano", + "u1.small", + "u1.xlarge", + "" + ] + }, + "instanceProfile": { + "type": "string", + "description": "Virtual Machine prefferences profile", + "default": "ubuntu", + "optional": true, + "enum": [ + "alpine", + "centos.7", + "centos.7.desktop", + "centos.stream10", + "centos.stream10.desktop", + "centos.stream8", + "centos.stream8.desktop", + "centos.stream8.dpdk", + "centos.stream9", + "centos.stream9.desktop", + "centos.stream9.dpdk", + "cirros", + "fedora", + "fedora.arm64", + "opensuse.leap", + "opensuse.tumbleweed", + "rhel.10", + "rhel.10.arm64", + "rhel.7", + "rhel.7.desktop", + "rhel.8", + "rhel.8.desktop", + "rhel.8.dpdk", + "rhel.9", + "rhel.9.arm64", + "rhel.9.desktop", + "rhel.9.dpdk", + "rhel.9.realtime", + "sles", + "ubuntu", + "windows.10", + "windows.10.virtio", + "windows.11", + "windows.11.virtio", + "windows.2k16", + "windows.2k16.virtio", + "windows.2k19", + "windows.2k19.virtio", + "windows.2k22", + "windows.2k22.virtio", + "windows.2k25", + "windows.2k25.virtio", + "" + ] + }, + "systemDisk": { + "type": "object", + "properties": { + "image": { + "type": "string", + "description": "The base image for the virtual machine. Allowed values: `ubuntu`, `cirros`, `alpine`, `fedora` and `talos`", + "default": "ubuntu", + "enum": [ + "ubuntu", + "cirros", + "alpine", + "fedora", + "talos" + ] + }, + "storage": { + "type": "string", + "description": "The size of the disk allocated for the virtual machine", + "default": "5Gi" + }, + "storageClass": { + "type": "string", + "description": "StorageClass used to store the data", + "default": "replicated" + } + } + }, + "resources": { + "type": "object", + "properties": { + "cpu": { + "type": "string", + "description": "The number of CPU cores allocated to the virtual machine", + "default": "" + }, + "memory": { + "type": "string", + "description": "The amount of memory allocated to the virtual machine", + "default": "" + } + } + }, + "sshKeys": { + "type": "array", + "description": "List of SSH public keys for authentication. Can be a single key or a list of keys.", + "default": "[]", + "items": { + "type": "string" + } + }, + "cloudInit": { + "type": "string", + "description": "cloud-init user data config. See cloud-init documentation for more details.", + "default": "#cloud-config\n" + } + } +} diff --git a/packages/apps/virtual-machine/values.yaml b/packages/apps/virtual-machine/values.yaml new file mode 100644 index 00000000..f1b0300e --- /dev/null +++ b/packages/apps/virtual-machine/values.yaml @@ -0,0 +1,51 @@ +## @section Common parameters + +## @param external Enable external access from outside the cluster +## @param externalPorts [array] Specify ports to forward from outside the cluster +external: false +externalPorts: +- 22 + +## @param running Determines if the virtual machine should be running +running: true + +## @param instanceType Virtual Machine instance type +## @param instanceProfile Virtual Machine prefferences profile +## +instanceType: "u1.medium" +instanceProfile: ubuntu + +## @param systemDisk.image The base image for the virtual machine. Allowed values: `ubuntu`, `cirros`, `alpine`, `fedora` and `talos` +## @param systemDisk.storage The size of the disk allocated for the virtual machine +## @param systemDisk.storageClass StorageClass used to store the data +## +systemDisk: + image: ubuntu + storage: 5Gi + storageClass: replicated + +## @param resources.cpu The number of CPU cores allocated to the virtual machine +## @param resources.memory The amount of memory allocated to the virtual machine +resources: + cpu: "" + memory: "" + +## @param sshKeys [array] List of SSH public keys for authentication. Can be a single key or a list of keys. +## Example: +## sshKeys: +## - ssh-rsa ... +## - ssh-ed25519 ... +## +sshKeys: [] + +## @param cloudInit cloud-init user data config. See cloud-init documentation for more details. +## - https://cloudinit.readthedocs.io/en/latest/explanation/format.html +## - https://cloudinit.readthedocs.io/en/latest/reference/examples.html +## Example: +## cloudInit: | +## #cloud-config +## password: ubuntu +## chpasswd: { expire: False } +## +cloudInit: | + #cloud-config diff --git a/packages/extra/versions_map b/packages/extra/versions_map index f5fadb77..14061a1c 100644 --- a/packages/extra/versions_map +++ b/packages/extra/versions_map @@ -6,7 +6,8 @@ etcd 2.2.0 5ca8823 etcd 2.3.0 HEAD ingress 1.0.0 f642698 ingress 1.1.0 838bee5d -ingress 1.2.0 HEAD +ingress 1.2.0 ced8e5b +ingress 1.3.0 HEAD monitoring 1.0.0 f642698 monitoring 1.1.0 15478a88 monitoring 1.2.0 c9e0d63b