Skip to content

Commit

Permalink
sync vm and pool options
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudymax committed Nov 24, 2024
1 parent 4d1725a commit 3452f1b
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 21 deletions.
2 changes: 1 addition & 1 deletion charts/kubevirt-vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Configure a virtual machine for use with Kubevirt
| virtualMachine.machine.pinCores | bool | `false` | Pin QEMU process 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.vCores | int | `4` | Number of Virtual cores to pass to the Guest ignored when instancetype is defined |
| virtualMachine.name | string | `"scrapmetal"` | name of the virtualMachine or virtualMachinePool object |
| virtualMachine.name | string | `"scrapmetal2"` | name of the virtualMachine or virtualMachinePool object |
| virtualMachine.namespace | string | `"kubevirt"` | namespace to deploy |
| virtualMachine.networks[0].name | string | `"default"` | |
| virtualMachine.networks[0].pod | object | `{}` | |
Expand Down
6 changes: 3 additions & 3 deletions charts/kubevirt-vm/templates/virtualmachine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ spec:
clock:
utc: {}
timer:
{{ if eq .Values.virtualMachine.features.clock.hpet.enabled true }}
{{- if eq .Values.virtualMachine.features.clock.hpet.enabled true }}
hpet:
present: {{ .Values.virtualMachine.features.clock.hpet.present }}
{{- end }}
{{ if eq .Values.virtualMachine.features.clock.pit.enabled true }}
{{- if eq .Values.virtualMachine.features.clock.pit.enabled true }}
pit:
tickPolicy: {{ .Values.virtualMachine.features.clock.pit.tickPolicy }}
{{- end }}
{{ if eq .Values.virtualMachine.features.clock.rtc.enabled true }}
{{- if eq .Values.virtualMachine.features.clock.rtc.enabled true }}
rtc:
tickPolicy: {{ .Values.virtualMachine.features.clock.rtc.tickPolicy }}
{{- end }}
Expand Down
74 changes: 60 additions & 14 deletions charts/kubevirt-vm/templates/virtualmachinepool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,81 @@ spec:
kubevirt-service: {{ .Values.virtualMachine.name }}
kubevirt-manager.io/managed: "true"
spec:
{{- if .Values.virtualMachine.machine.instancetype }}
{{- if eq .Values.virtualMachine.machine.instancetype.enabled true }}
instancetype:
name: {{ .Values.virtualMachine.machine.instancetype.name }}
kind: {{ .Values.virtualMachine.machine.instancetype.kind }}
{{- end }}
running: true
runStrategy: {{ .Values.virtualMachine.runStrategy }}
template:
metadata:
creationTimestamp: null
labels:
kubevirt.io/vmpool: {{ .Values.virtualMachine.name }}
kubevirt.io/domain: {{ .Values.virtualMachine.name }}
kubevirt-service: {{ .Values.virtualMachine.name }}
kubevirt-manager.io/managed: "true"
spec:
architecture: {{ .Values.virtualMachine.machine.architecture }}
domain:
machine:
type: {{ .Values.virtualMachine.machine.machineType }}
{{- if eq .Values.virtualMachine.features.clock.enabled true }}
clock:
utc: {}
timer:
{{- if eq .Values.virtualMachine.features.clock.hpet.enabled true }}
hpet:
present: {{ .Values.virtualMachine.features.clock.hpet.present }}
{{- end }}
{{- if eq .Values.virtualMachine.features.clock.pit.enabled true }}
pit:
tickPolicy: {{ .Values.virtualMachine.features.clock.pit.tickPolicy }}
{{- end }}
{{- if eq .Values.virtualMachine.features.clock.rtc.enabled true }}
rtc:
tickPolicy: {{ .Values.virtualMachine.features.clock.rtc.tickPolicy }}
{{- end }}
{{- if eq .Values.virtualMachine.features.clock.hyperv true }}
hyperv: {}
{{- end }}
{{- if eq .Values.virtualMachine.features.clock.kvm true }}
kvm: {}
{{- end }}
{{- end }}
features:
{{- if .Values.virtualMachine.features.kvmEnabled -}}
{{- if eq .Values.virtualMachine.features.kvmEnabled true -}}
{{ "kvm: {}" | nindent 14 }}
{{- end }}
{{- if .Values.virtualMachine.features.acpiEnabled -}}
{{- if eq .Values.virtualMachine.features.acpiEnabled true -}}
{{ "acpi: {}" | nindent 14 }}
{{- end }}
{{- if .Values.virtualMachine.features.smmEnabled -}}
{{- if eq .Values.virtualMachine.features.smmEnabled true -}}
{{ "smm:" | nindent 14 -}}
{{ "enabled: true" | nindent 16 }}
{{- end }}
{{- if eq .Values.virtualMachine.features.hyperv true }}
hyperv:
relaxed: {}
vapic: {}
vpindex: {}
spinlocks:
spinlocks: 8191
synic: {}
synictimer:
direct: {}
tlbflush: {}
frequencies: {}
reenlightenment: {}
ipi: {}
runtime: {}
reset: {}
{{- end }}
cpu:
{{- if .Values.virtualMachine.machine.cpuPassthrough -}}
{{ "model: host-passthrough" | nindent 14 }}
{{- if eq .Values.virtualMachine.machine.pinCores true }}
dedicatedCpuPlacement: true
{{- end }}
{{- if not .Values.virtualMachine.machine.instancetype }}
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 -}}
Expand All @@ -69,15 +112,15 @@ spec:
bootloader:
efi:
secureBoot: {{ .Values.virtualMachine.features.secureBoot }}
{{ else }}
{{- else }}
bootloader: {}
{{- end }}
devices:
{{- with .Values.virtualMachine.interfaces }}
interfaces:
{{- toYaml . | nindent 14 }}
{{- end }}
{{- if not .Values.virtualMachine.machine.instancetype }}
{{- if eq .Values.virtualMachine.machine.instancetype.enabled false }}
{{- with .Values.virtualMachine.gpus }}
gpus:
{{- toYaml . | nindent 14 }}
Expand All @@ -87,6 +130,7 @@ spec:
autoattachSerialConsole: {{ .Values.virtualMachine.features.autoattachSerialConsole }}
autoattachGraphicsDevice: {{ .Values.virtualMachine.features.autoattachGraphicsDevice }}
networkInterfaceMultiqueue: {{ .Values.virtualMachine.features.networkInterfaceMultiqueue }}
rng: {}
inputs:
- type: tablet
bus: virtio
Expand All @@ -107,23 +151,25 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if $props.configMap }}
{{- if eq $props.type "configmap" }}
- name: {{ $props.name }}
serial: {{ $props.serialNumber }}
cdrom:
bus: sata
{{- end }}
{{- if eq $props.type "secret" }}
- name: {{ $props.name }}
serial: {{ $props.serialNumber }}
{{- end }}
{{- end }}
{{- if not .Values.virtualMachine.machine.instancetype }}
{{- if eq .Values.virtualMachine.machine.instancetype.enabled false }}
resources:
limits:
memory: {{ .Values.virtualMachine.machine.memory }}
{{- end }}
{{- with .Values.virtualMachine.networks }}
networks:
{{- toYaml . | nindent 10 }}
{{- toYaml . | nindent 12 }}
{{- end }}
terminationGracePeriodSeconds: 0
priorityClassName: {{ .Values.virtualMachine.machine.priorityClassName }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kubevirt-vm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Virtual Machine settings
virtualMachine:
# -- name of the virtualMachine or virtualMachinePool object
name: scrapmetal
name: scrapmetal2
# -- namespace to deploy
namespace: kubevirt
# -- One of 'Always' `RerunOnFailure` `Manual` `Halted` `Once`
Expand Down
18 changes: 16 additions & 2 deletions charts/kubevirt-vm/win-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,27 @@ virtualMachine:
autoattachPodInterface: true
autoattachSerialConsole: true
autoattachGraphicsDevice: true
hyperv: true
clock:
enabled: true
hpet:
enabled: true
present: false
pit:
enabled: true
tickPolicy: delay
rtc:
enabled: true
tickPolicy: catchup
kvm: false
hyperv: true

machine:
instancetype:
enabled: false
priorityClassName: vm-standard
machineType: "q35"
cpuPassthrough: true
cpuModel: host-passthrough
vCores: 4
pinCores: false
hyperThreadingEnabled: true
Expand All @@ -31,7 +45,7 @@ virtualMachine:
interfaces:
- name: default
bridge: {}
model: e1000e
model: e1000

networks:
- name: default
Expand Down

0 comments on commit 3452f1b

Please sign in to comment.