From f739e59a4932214782d686905f4d92d419743751 Mon Sep 17 00:00:00 2001 From: cloudymax Date: Sat, 14 Dec 2024 11:56:36 +0100 Subject: [PATCH 1/8] move clock options out of features, it can be its own thing --- .../kubevirt-vm/templates/virtualmachine.yaml | 19 +++++----- charts/kubevirt-vm/values.yaml | 36 +++++++++---------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/charts/kubevirt-vm/templates/virtualmachine.yaml b/charts/kubevirt-vm/templates/virtualmachine.yaml index 2a5c1cd..8f02f51 100644 --- a/charts/kubevirt-vm/templates/virtualmachine.yaml +++ b/charts/kubevirt-vm/templates/virtualmachine.yaml @@ -26,26 +26,26 @@ spec: domain: machine: type: {{ .Values.virtualMachine.machine.machineType }} - {{- if eq .Values.virtualMachine.features.clock.enabled true }} + {{- if eq .Values.virtualMachine.clock.enabled true }} clock: utc: {} timer: - {{- if eq .Values.virtualMachine.features.clock.hpet.enabled true }} + {{- if eq .Values.virtualMachine.clock.hpet.enabled true }} hpet: - present: {{ .Values.virtualMachine.features.clock.hpet.present }} + present: {{ .Values.virtualMachine.clock.hpet.present }} {{- end }} - {{- if eq .Values.virtualMachine.features.clock.pit.enabled true }} + {{- if eq .Values.virtualMachine.clock.pit.enabled true }} pit: - tickPolicy: {{ .Values.virtualMachine.features.clock.pit.tickPolicy }} + tickPolicy: {{ .Values.virtualMachine.clock.pit.tickPolicy }} {{- end }} - {{- if eq .Values.virtualMachine.features.clock.rtc.enabled true }} + {{- if eq .Values.virtualMachine.clock.rtc.enabled true }} rtc: - tickPolicy: {{ .Values.virtualMachine.features.clock.rtc.tickPolicy }} + tickPolicy: {{ .Values.virtualMachine.clock.rtc.tickPolicy }} {{- end }} - {{- if eq .Values.virtualMachine.features.clock.hyperv true }} + {{- if eq .Values.virtualMachine.clock.hyperv true }} hyperv: {} {{- end }} - {{- if eq .Values.virtualMachine.features.clock.kvm true }} + {{- if eq .Values.virtualMachine.clock.kvm true }} kvm: {} {{- end }} {{- end }} @@ -180,6 +180,7 @@ spec: {{ else }} memory: {{ .Values.virtualMachine.machine.memory.base }} {{- end }} + {{- if }} cpu: {{ .Values.virtualMachine.machine.vCores }} {{- end }} {{- with .Values.virtualMachine.networks }} diff --git a/charts/kubevirt-vm/values.yaml b/charts/kubevirt-vm/values.yaml index 3fcfa5d..276997e 100644 --- a/charts/kubevirt-vm/values.yaml +++ b/charts/kubevirt-vm/values.yaml @@ -35,26 +35,26 @@ virtualMachine: # -- Enhances network performance by allowing multiple TX and RX queues. networkInterfaceMultiqueue: true - # -- Options for machine clock - clock: + # -- Options for machine clock + clock: + enabled: true + + # -- High Precision Event Timer + hpet: + enabled: true + present: false + + # -- Programmable interval timer + pit: enabled: true + tickPolicy: delay - # -- High Precision Event Timer - hpet: - enabled: true - present: false - - # -- Programmable interval timer - pit: - enabled: true - tickPolicy: delay - - # -- Real-Time Clock - rtc: - enabled: true - tickPolicy: catchup - kvm: true - hyperv: false + # -- Real-Time Clock + rtc: + enabled: true + tickPolicy: catchup + kvm: true + hyperv: false firmware: # Enable System Management Mode (required for secureboot) From 9879edb25e24091f8742b55716b76fb7cb1f93f5 Mon Sep 17 00:00:00 2001 From: cloudymax Date: Sat, 14 Dec 2024 11:57:28 +0100 Subject: [PATCH 2/8] bump chart and readme --- charts/kubevirt-vm/Chart.yaml | 2 +- charts/kubevirt-vm/README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/kubevirt-vm/Chart.yaml b/charts/kubevirt-vm/Chart.yaml index cdb8e13..de7ae46 100644 --- a/charts/kubevirt-vm/Chart.yaml +++ b/charts/kubevirt-vm/Chart.yaml @@ -3,7 +3,7 @@ name: kubevirt-vm description: Configure a virtual machine for use with Kubevirt type: application -version: 0.4.4 +version: 0.4.5 appVersion: "0.1.0" maintainers: diff --git a/charts/kubevirt-vm/README.md b/charts/kubevirt-vm/README.md index 3fa5f92..e7850ad 100644 --- a/charts/kubevirt-vm/README.md +++ b/charts/kubevirt-vm/README.md @@ -1,6 +1,6 @@ # kubevirt-vm -![Version: 0.4.4](https://img.shields.io/badge/Version-0.4.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square) +![Version: 0.4.5](https://img.shields.io/badge/Version-0.4.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square) Configure a virtual machine for use with Kubevirt @@ -56,12 +56,12 @@ Configure a virtual machine for use with Kubevirt | disks[0].url | string | `"https://buildstars.online/debian-12-generic-amd64-daily.qcow2"` | URL of cloud-image | | service | list | `[{"externalTrafficPolicy":"Cluster","name":"service","ports":[{"name":"ssh","port":22,"protocol":"TCP","targetPort":22},{"name":"vnc","port":5900,"protocol":"TCP","targetPort":5900}],"type":"NodePort"}]` | Service cinfiguration. Used to expose VM to the outside world. Accepts a list of ports to open. | | userDataSecret | object | `{"enabled":false,"name":""}` | Use an existing cloud-init userdata secret ignored if cloudinit subchart is enabled. | +| virtualMachine.clock | object | `{"enabled":true,"hpet":{"enabled":true,"present":false},"hyperv":false,"kvm":true,"pit":{"enabled":true,"tickPolicy":"delay"},"rtc":{"enabled":true,"tickPolicy":"catchup"}}` | Options for machine clock | +| virtualMachine.clock.hpet | object | `{"enabled":true,"present":false}` | High Precision Event Timer | | virtualMachine.features.acpiEnabled | bool | `true` | | | virtualMachine.features.autoattachGraphicsDevice | bool | `true` | Attach a basic graphics device for VNC access | | virtualMachine.features.autoattachPodInterface | bool | `true` | Make pod network interface the default for the VM | | virtualMachine.features.autoattachSerialConsole | bool | `true` | Attach a serial console device | -| virtualMachine.features.clock | object | `{"enabled":true,"hpet":{"enabled":true,"present":false},"hyperv":false,"kvm":true,"pit":{"enabled":true,"tickPolicy":"delay"},"rtc":{"enabled":true,"tickPolicy":"catchup"}}` | Options for machine clock | -| virtualMachine.features.clock.hpet | object | `{"enabled":true,"present":false}` | High Precision Event Timer | | virtualMachine.features.hyperv | bool | `false` | | | virtualMachine.features.kvm | object | `{"enabled":true,"hidden":true}` | Enable KVM acceleration | | virtualMachine.features.networkInterfaceMultiqueue | bool | `true` | Enhances network performance by allowing multiple TX and RX queues. | From 98aa71b9a40a7fed9b9be79585e7d9d9df0bc584 Mon Sep 17 00:00:00 2001 From: cloudymax Date: Sat, 14 Dec 2024 11:59:53 +0100 Subject: [PATCH 3/8] make resouces strings --- charts/kubevirt-vm/templates/virtualmachine.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/kubevirt-vm/templates/virtualmachine.yaml b/charts/kubevirt-vm/templates/virtualmachine.yaml index 8f02f51..eb74df1 100644 --- a/charts/kubevirt-vm/templates/virtualmachine.yaml +++ b/charts/kubevirt-vm/templates/virtualmachine.yaml @@ -172,16 +172,16 @@ spec: overcommitGuestOverhead: {{ .Values.virtualMachine.machine.memory.overcommit.overhead }} {{- end }} requests: - memory: {{ .Values.virtualMachine.machine.memory.base }} - cpu: {{ .Values.virtualMachine.machine.vCores }} + memory: {{ .Values.virtualMachine.machine.memory.base | toString }} + cpu: {{ .Values.virtualMachine.machine.vCores | toString }} limits: {{- if eq .Values.virtualMachine.machine.memory.overcommit.enabled true }} - memory: {{ .Values.virtualMachine.machine.memory.overcommit.limit }} + memory: {{ .Values.virtualMachine.machine.memory.overcommit.limit | toString }} {{ else }} - memory: {{ .Values.virtualMachine.machine.memory.base }} + memory: {{ .Values.virtualMachine.machine.memory.base | toString }} {{- end }} {{- if }} - cpu: {{ .Values.virtualMachine.machine.vCores }} + cpu: {{ .Values.virtualMachine.machine.vCores | toString }} {{- end }} {{- with .Values.virtualMachine.networks }} networks: From fb8a934d223551b2e4021dba3e9e415622f48eeb Mon Sep 17 00:00:00 2001 From: cloudymax Date: Sat, 14 Dec 2024 12:28:52 +0100 Subject: [PATCH 4/8] force resouces to be quoted --- charts/kubevirt-vm/templates/virtualmachine.yaml | 15 +++++++++------ charts/kubevirt-vm/values.yaml | 12 ++++++++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/charts/kubevirt-vm/templates/virtualmachine.yaml b/charts/kubevirt-vm/templates/virtualmachine.yaml index eb74df1..1ef25c3 100644 --- a/charts/kubevirt-vm/templates/virtualmachine.yaml +++ b/charts/kubevirt-vm/templates/virtualmachine.yaml @@ -28,7 +28,11 @@ spec: type: {{ .Values.virtualMachine.machine.machineType }} {{- if eq .Values.virtualMachine.clock.enabled true }} clock: + {{- if eq .Values.virtualMachine.clock.timezone "utc" }} utc: {} + {{ else }} + timezone: {{ .Values.virtualMachine.clock.timezone }} + {{- end }} timer: {{- if eq .Values.virtualMachine.clock.hpet.enabled true }} hpet: @@ -172,16 +176,15 @@ spec: overcommitGuestOverhead: {{ .Values.virtualMachine.machine.memory.overcommit.overhead }} {{- end }} requests: - memory: {{ .Values.virtualMachine.machine.memory.base | toString }} - cpu: {{ .Values.virtualMachine.machine.vCores | toString }} + memory: {{ .Values.virtualMachine.machine.memory.base | quote }} + cpu: {{ .Values.virtualMachine.machine.vCores | quote }} limits: {{- if eq .Values.virtualMachine.machine.memory.overcommit.enabled true }} - memory: {{ .Values.virtualMachine.machine.memory.overcommit.limit | toString }} + memory: {{ .Values.virtualMachine.machine.memory.overcommit.limit | quote }} {{ else }} - memory: {{ .Values.virtualMachine.machine.memory.base | toString }} + memory: {{ .Values.virtualMachine.machine.memory.base | quote }} {{- end }} - {{- if }} - cpu: {{ .Values.virtualMachine.machine.vCores | toString }} + cpu: {{ .Values.virtualMachine.machine.vCores | quote }} {{- end }} {{- with .Values.virtualMachine.networks }} networks: diff --git a/charts/kubevirt-vm/values.yaml b/charts/kubevirt-vm/values.yaml index 276997e..64c0568 100644 --- a/charts/kubevirt-vm/values.yaml +++ b/charts/kubevirt-vm/values.yaml @@ -39,21 +39,29 @@ virtualMachine: clock: enabled: true + # -- Set clock timezone eg: "Europe/Amsterdam" or "utc" + timezone: utc + # -- High Precision Event Timer hpet: enabled: true present: false - # -- Programmable interval timer + # -- Programmable interval timer pit: enabled: true tickPolicy: delay - # -- Real-Time Clock + # -- Real-Time Clock rtc: enabled: true tickPolicy: catchup + + # -- Paravirtualized clock that provides better accuracy and performance. + # Recommended clock source for KVM guest virtual machines. kvm: true + + # -- Hyper-V's reference time counter for use with Windows guests. hyperv: false firmware: From 4ee8479cba7e5c7bdd8653974a886db4ab4be4eb Mon Sep 17 00:00:00 2001 From: cloudymax Date: Sat, 14 Dec 2024 12:29:26 +0100 Subject: [PATCH 5/8] update readme --- charts/kubevirt-vm/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/kubevirt-vm/README.md b/charts/kubevirt-vm/README.md index e7850ad..acf3491 100644 --- a/charts/kubevirt-vm/README.md +++ b/charts/kubevirt-vm/README.md @@ -56,8 +56,13 @@ Configure a virtual machine for use with Kubevirt | disks[0].url | string | `"https://buildstars.online/debian-12-generic-amd64-daily.qcow2"` | URL of cloud-image | | service | list | `[{"externalTrafficPolicy":"Cluster","name":"service","ports":[{"name":"ssh","port":22,"protocol":"TCP","targetPort":22},{"name":"vnc","port":5900,"protocol":"TCP","targetPort":5900}],"type":"NodePort"}]` | Service cinfiguration. Used to expose VM to the outside world. Accepts a list of ports to open. | | userDataSecret | object | `{"enabled":false,"name":""}` | Use an existing cloud-init userdata secret ignored if cloudinit subchart is enabled. | -| virtualMachine.clock | object | `{"enabled":true,"hpet":{"enabled":true,"present":false},"hyperv":false,"kvm":true,"pit":{"enabled":true,"tickPolicy":"delay"},"rtc":{"enabled":true,"tickPolicy":"catchup"}}` | Options for machine clock | +| virtualMachine.clock | object | `{"enabled":true,"hpet":{"enabled":true,"present":false},"hyperv":false,"kvm":true,"pit":{"enabled":true,"tickPolicy":"delay"},"rtc":{"enabled":true,"tickPolicy":"catchup"},"timezone":"utc"}` | Options for machine clock | | virtualMachine.clock.hpet | object | `{"enabled":true,"present":false}` | High Precision Event Timer | +| virtualMachine.clock.hyperv | bool | `false` | Hyper-V's reference time counter for use with Windows guests. | +| virtualMachine.clock.kvm | bool | `true` | Paravirtualized clock that provides better accuracy and performance. Recommended clock source for KVM guest virtual machines. | +| virtualMachine.clock.pit | object | `{"enabled":true,"tickPolicy":"delay"}` | Programmable interval timer | +| virtualMachine.clock.rtc | object | `{"enabled":true,"tickPolicy":"catchup"}` | Real-Time Clock | +| virtualMachine.clock.timezone | string | `"utc"` | Set clock timezone eg: "Europe/Amsterdam" or "utc" | | virtualMachine.features.acpiEnabled | bool | `true` | | | virtualMachine.features.autoattachGraphicsDevice | bool | `true` | Attach a basic graphics device for VNC access | | virtualMachine.features.autoattachPodInterface | bool | `true` | Make pod network interface the default for the VM | From f549cb282f3ed44fc8e93fc3b42fd9c0aa173029 Mon Sep 17 00:00:00 2001 From: cloudymax Date: Sat, 14 Dec 2024 12:50:54 +0100 Subject: [PATCH 6/8] make cpu topology options turn on or off based on if pinCores is set --- .../kubevirt-vm/templates/virtualmachine.yaml | 8 +++++--- charts/kubevirt-vm/values.yaml | 20 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/charts/kubevirt-vm/templates/virtualmachine.yaml b/charts/kubevirt-vm/templates/virtualmachine.yaml index 1ef25c3..c5e8273 100644 --- a/charts/kubevirt-vm/templates/virtualmachine.yaml +++ b/charts/kubevirt-vm/templates/virtualmachine.yaml @@ -88,14 +88,16 @@ spec: {{- end }} model: {{ .Values.virtualMachine.machine.cpuModel }} {{- if eq .Values.virtualMachine.machine.instancetype.enabled false }} - sockets: 1 - cores: {{ .Values.virtualMachine.machine.vCores -}} - {{- if .Values.virtualMachine.machine.hyperThreadingEnabled -}} + {{- if eq .Values.virtualMachine.machine.pinCores false }} + sockets: {{ .Values.virtualMachine.machine.sockets }} + cores: {{ .Values.virtualMachine.machine.vCores }} + {{- if .Values.virtualMachine.machine.hyperThreadingEnabled }} {{- "threads: 2" | nindent 10 -}} {{ else }} {{- "threads: 1" | nindent 10 -}} {{- end }} {{- end }} + {{- end }} {{- if eq .Values.virtualMachine.machine.instancetype.enabled false }} memory: {{- if eq .Values.virtualMachine.machine.memory.overcommit.enabled false }} diff --git a/charts/kubevirt-vm/values.yaml b/charts/kubevirt-vm/values.yaml index 64c0568..6ca7b52 100644 --- a/charts/kubevirt-vm/values.yaml +++ b/charts/kubevirt-vm/values.yaml @@ -15,7 +15,7 @@ virtualMachine: # -- Enable KVM acceleration kvm: enabled: true - hidden: true + hidden: false # -- Set default hyperv settings for windows guests hyperv: false @@ -86,10 +86,10 @@ virtualMachine: name: standard-small kind: virtualMachineClusterInstancetype - # -- Arch + # -- System Arch. Supported options are amd64 and arm64 architecture: amd64 - # -- QEMU virtual-machine type + # -- QEMU virtual-machine type. Options are q35 and i440fx machineType: q35 # -- Specify hots-passthrough or a named cpu model @@ -100,13 +100,18 @@ virtualMachine: # ignored when instancetype is defined vCores: 4 - # -- Pin QEMU process to specific physical core + # -- Number of simulated CPU sockets. + # ignored if pinCores set to "true" + sockets: 1 + + # -- Enable simulation of Hyperthre ading on Intel CPUs or SMT AMD CPUs. + # ignored if pinCores set to "true" + hyperThreadingEnabled: false + + # -- Pin QEMU process threads to specific physical cores # Requires `--cpu-manager-policy` enabled in kubelet pinCores: false - # -- Enable the use of Hyperthreading on Intel CPUs. Disable on AMD CPUs. - hyperThreadingEnabled: true - # -- Amount of RAM to pass to the Guest. Ignored when instancetype is defined memory: base: 4Gi @@ -333,7 +338,6 @@ service: targetPort: 5900 protocol: TCP - # -- set tieming and port number for liveness probe # livenessProbe: # initialDelaySeconds: 120 From 8ee8d392215278b8e07989b7292fc1c50b2235f8 Mon Sep 17 00:00:00 2001 From: cloudymax Date: Sat, 14 Dec 2024 15:32:33 +0100 Subject: [PATCH 7/8] add resources to cloudinit job --- charts/cloud-init/Chart.yaml | 2 +- charts/cloud-init/README.md | 2 +- charts/cloud-init/templates/job.yaml | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/charts/cloud-init/Chart.yaml b/charts/cloud-init/Chart.yaml index 29fb3cf..57ca70c 100644 --- a/charts/cloud-init/Chart.yaml +++ b/charts/cloud-init/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v2 name: cloud-init description: A Helm chart that generates cloud-init config files type: application -version: 0.2.6 +version: 0.2.7 maintainers: - name: cloudymax diff --git a/charts/cloud-init/README.md b/charts/cloud-init/README.md index 62c320d..7e55ffb 100644 --- a/charts/cloud-init/README.md +++ b/charts/cloud-init/README.md @@ -1,6 +1,6 @@ # cloud-init -![Version: 0.2.6](https://img.shields.io/badge/Version-0.2.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 0.2.7](https://img.shields.io/badge/Version-0.2.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) A Helm chart that generates cloud-init config files diff --git a/charts/cloud-init/templates/job.yaml b/charts/cloud-init/templates/job.yaml index 9603e5f..cbb7a83 100644 --- a/charts/cloud-init/templates/job.yaml +++ b/charts/cloud-init/templates/job.yaml @@ -60,6 +60,13 @@ spec: command: ["/bin/bash", "/optimize.sh"] {{- end }} imagePullPolicy: IfNotPresent + resources: + limits: + cpu: 250m + memory: 512M + requests: + cpu: 250m + memory: 512M volumeMounts: - name: userdata mountPath: /secrets/user-data.yaml From 47582a4489df904009030b85fc731f6cf58df14c Mon Sep 17 00:00:00 2001 From: cloudymax Date: Sat, 14 Dec 2024 15:34:18 +0100 Subject: [PATCH 8/8] debugging autoscaling --- charts/cloud-init/values.yaml | 1 - charts/kubevirt-vm/README.md | 11 ++--- .../templates/virtualmachinepool.yaml | 40 +++++++++++-------- charts/kubevirt-vm/values.yaml | 2 +- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/charts/cloud-init/values.yaml b/charts/cloud-init/values.yaml index 97616a9..a30a132 100644 --- a/charts/cloud-init/values.yaml +++ b/charts/cloud-init/values.yaml @@ -37,7 +37,6 @@ extraEnvVars: [] # name: test # key: "test.yaml" - # -- virtual-machine hostname hostname: random diff --git a/charts/kubevirt-vm/README.md b/charts/kubevirt-vm/README.md index acf3491..91709bd 100644 --- a/charts/kubevirt-vm/README.md +++ b/charts/kubevirt-vm/README.md @@ -68,7 +68,7 @@ Configure a virtual machine for use with Kubevirt | virtualMachine.features.autoattachPodInterface | bool | `true` | Make pod network interface the default for the VM | | virtualMachine.features.autoattachSerialConsole | bool | `true` | Attach a serial console device | | virtualMachine.features.hyperv | bool | `false` | | -| virtualMachine.features.kvm | object | `{"enabled":true,"hidden":true}` | Enable KVM acceleration | +| virtualMachine.features.kvm | object | `{"enabled":true,"hidden":false}` | Enable KVM acceleration | | virtualMachine.features.networkInterfaceMultiqueue | bool | `true` | Enhances network performance by allowing multiple TX and RX queues. | | virtualMachine.firmware.efi | object | `{"enabled":true,"secureBoot":false}` | Enable EFI bios and secureboot | | virtualMachine.firmware.smmEnabled | bool | `false` | | @@ -76,16 +76,17 @@ Configure a virtual machine for use with Kubevirt | virtualMachine.gpus | list | `[]` | GPUs to pass to guest, requires that the GPUs are pre-configured in the kubevirt custom resource. ignored when instancetype is defined. ramFB & display may only be enabled on 1 vGPU | | virtualMachine.interfaces | list | `[{"masquerade":{},"model":"virtio","name":"default"}]` | virtual network interface config options. See: https://kubevirt.io/user-guide/network/interfaces_and_networks/#interfaces | | virtualMachine.interfaces[0] | object | `{"masquerade":{},"model":"virtio","name":"default"}` | bridge mode, vms are connected to the network via a linux "bridge". Pod network IP is delegated to vm via DHCPv4. VM must use DHCP for an IP | -| virtualMachine.machine.architecture | string | `"amd64"` | Arch | +| virtualMachine.machine.architecture | string | `"amd64"` | System Arch. Supported options are amd64 and arm64 | | virtualMachine.machine.cpuModel | string | `"host-passthrough"` | Specify hots-passthrough or a named cpu model https://www.qemu.org/docs/master/system/qemu-cpu-models.html | -| virtualMachine.machine.hyperThreadingEnabled | bool | `true` | Enable the use of Hyperthreading on Intel CPUs. Disable on AMD CPUs. | +| virtualMachine.machine.hyperThreadingEnabled | bool | `false` | Enable simulation of Hyperthre ading on Intel CPUs or SMT AMD CPUs. ignored if pinCores set to "true" | | virtualMachine.machine.instancetype | object | `{"enabled":false,"kind":"virtualMachineClusterInstancetype","name":"standard-small"}` | Define CPU, RAM, GPU, HostDevice settings for VMs. Overrides: vCores, memory, gpus | -| virtualMachine.machine.machineType | string | `"q35"` | QEMU virtual-machine type | +| virtualMachine.machine.machineType | string | `"q35"` | QEMU virtual-machine type. Options are q35 and i440fx | | virtualMachine.machine.memory | object | `{"base":"4Gi","overcommit":{"enabled":false,"limit":"8Gi","overhead":false}}` | Amount of RAM to pass to the Guest. Ignored when instancetype is defined | | virtualMachine.machine.memory.overcommit.enabled | bool | `false` | Enable memory overcommitment. Tells VM it has more RAM than requested. VMI becomes Burtable QOS class and may be preempted when node is under memory pressure. GPU passthrough and vGPU will not function with overcommit enabled. | | virtualMachine.machine.memory.overcommit.overhead | bool | `false` | Do not allocate hypervisor overhead memory to VM. Will work for as long as most of the VirtualMachineInstances do not request the full memory. | -| virtualMachine.machine.pinCores | bool | `false` | Pin QEMU process to specific physical core Requires `--cpu-manager-policy` enabled in kubelet | +| virtualMachine.machine.pinCores | bool | `false` | Pin QEMU process threads to specific physical cores Requires `--cpu-manager-policy` enabled in kubelet | | virtualMachine.machine.priorityClassName | string | `"vm-standard"` | If a Pod cannot be scheduled, lower priorityClass Pods will be evicted | +| virtualMachine.machine.sockets | int | `1` | Number of simulated CPU sockets. ignored if pinCores set to "true" | | virtualMachine.machine.vCores | int | `4` | Number of Virtual cores to pass to the Guest ignored when instancetype is defined | | virtualMachine.name | string | `"test"` | name of the virtualMachine or virtualMachinePool object | | virtualMachine.namespace | string | `"kubevirt"` | namespace to deploy to | diff --git a/charts/kubevirt-vm/templates/virtualmachinepool.yaml b/charts/kubevirt-vm/templates/virtualmachinepool.yaml index 9a6bed2..d49d4bd 100644 --- a/charts/kubevirt-vm/templates/virtualmachinepool.yaml +++ b/charts/kubevirt-vm/templates/virtualmachinepool.yaml @@ -42,26 +42,30 @@ spec: domain: machine: type: {{ .Values.virtualMachine.machine.machineType }} - {{- if eq .Values.virtualMachine.features.clock.enabled true }} + {{- if eq .Values.virtualMachine.clock.enabled true }} clock: + {{- if eq .Values.virtualMachine.clock.timezone "utc" }} utc: {} + {{ else }} + timezone: {{ .Values.virtualMachine.clock.timezone }} + {{- end }} timer: - {{- if eq .Values.virtualMachine.features.clock.hpet.enabled true }} + {{- if eq .Values.virtualMachine.clock.hpet.enabled true }} hpet: - present: {{ .Values.virtualMachine.features.clock.hpet.present }} + present: {{ .Values.virtualMachine.clock.hpet.present }} {{- end }} - {{- if eq .Values.virtualMachine.features.clock.pit.enabled true }} + {{- if eq .Values.virtualMachine.clock.pit.enabled true }} pit: - tickPolicy: {{ .Values.virtualMachine.features.clock.pit.tickPolicy }} + tickPolicy: {{ .Values.virtualMachine.clock.pit.tickPolicy }} {{- end }} - {{- if eq .Values.virtualMachine.features.clock.rtc.enabled true }} + {{- if eq .Values.virtualMachine.clock.rtc.enabled true }} rtc: - tickPolicy: {{ .Values.virtualMachine.features.clock.rtc.tickPolicy }} + tickPolicy: {{ .Values.virtualMachine.clock.rtc.tickPolicy }} {{- end }} - {{- if eq .Values.virtualMachine.features.clock.hyperv true }} + {{- if eq .Values.virtualMachine.clock.hyperv true }} hyperv: {} {{- end }} - {{- if eq .Values.virtualMachine.features.clock.kvm true }} + {{- if eq .Values.virtualMachine.clock.kvm true }} kvm: {} {{- end }} {{- end }} @@ -100,14 +104,16 @@ spec: {{- end }} model: {{ .Values.virtualMachine.machine.cpuModel }} {{- if eq .Values.virtualMachine.machine.instancetype.enabled false }} - sockets: 1 - cores: {{ .Values.virtualMachine.machine.vCores -}} - {{- if .Values.virtualMachine.machine.hyperThreadingEnabled -}} + {{- if eq .Values.virtualMachine.machine.pinCores false }} + sockets: {{ .Values.virtualMachine.machine.sockets }} + cores: {{ .Values.virtualMachine.machine.vCores }} + {{- if .Values.virtualMachine.machine.hyperThreadingEnabled }} {{- "threads: 2" | nindent 14 -}} {{ else }} {{- "threads: 1" | nindent 14 -}} {{- end }} {{- end }} + {{- end }} {{- if eq .Values.virtualMachine.machine.instancetype.enabled false }} memory: {{- if eq .Values.virtualMachine.machine.memory.overcommit.enabled false }} @@ -188,15 +194,15 @@ spec: overcommitGuestOverhead: {{ .Values.virtualMachine.machine.memory.overcommit.overhead }} {{- end }} requests: - memory: {{ .Values.virtualMachine.machine.memory.base }} - cpu: {{ .Values.virtualMachine.machine.vCores }} + memory: {{ .Values.virtualMachine.machine.memory.base | quote }} + cpu: {{ .Values.virtualMachine.machine.vCores | quote }} limits: {{- if eq .Values.virtualMachine.machine.memory.overcommit.enabled true }} - memory: {{ .Values.virtualMachine.machine.memory.overcommit.limit }} + memory: {{ .Values.virtualMachine.machine.memory.overcommit.limit | quote }} {{ else }} - memory: {{ .Values.virtualMachine.machine.memory.base }} + memory: {{ .Values.virtualMachine.machine.memory.base | quote }} {{- end }} - cpu: {{ .Values.virtualMachine.machine.vCores }} + cpu: {{ .Values.virtualMachine.machine.vCores | quote }} {{- end }} {{- with .Values.virtualMachine.networks }} networks: diff --git a/charts/kubevirt-vm/values.yaml b/charts/kubevirt-vm/values.yaml index 6ca7b52..4f14939 100644 --- a/charts/kubevirt-vm/values.yaml +++ b/charts/kubevirt-vm/values.yaml @@ -158,7 +158,7 @@ virtualMachine: # Vm pools should be used with ephemeral disks or containerdisks # otherwise they would all fight over the same PVC. virtualMachinePool: - enabled: false + enabled: true # -- number of replicas to create. Ignored when hpa is set to 'true' replicas: 1