From d1253db4eefb78a157ab42a066df21bae1b26123 Mon Sep 17 00:00:00 2001 From: George Page Date: Sun, 4 Feb 2024 23:05:35 +0800 Subject: [PATCH] Enable CPU Type on machine template --- api/v1beta1/type.go | 4 ++-- cloud/services/compute/instance/qemu.go | 1 + .../infrastructure.cluster.x-k8s.io_proxmoxmachines.yaml | 3 +++ ...frastructure.cluster.x-k8s.io_proxmoxmachinetemplates.yaml | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/api/v1beta1/type.go b/api/v1beta1/type.go index aca7623..0221840 100644 --- a/api/v1beta1/type.go +++ b/api/v1beta1/type.go @@ -68,8 +68,8 @@ type Hardware struct { // +kubebuilder:default:=2 CPU int `json:"cpu,omitempty"` - // emulated cpu type - // CPUType string `json:"cpuType,omitempty"` + // Emulated CPU Type. Defaults to kvm64 + CPUType string `json:"cpuType,omitempty"` // +kubebuilder:validation:Minimum:=1 // The number of CPU sockets. Defaults to 1. diff --git a/cloud/services/compute/instance/qemu.go b/cloud/services/compute/instance/qemu.go index 7d5d9db..08b5bbd 100644 --- a/cloud/services/compute/instance/qemu.go +++ b/cloud/services/compute/instance/qemu.go @@ -105,6 +105,7 @@ func (s *Service) generateVMOptions() api.VirtualMachineCreateOptions { Boot: fmt.Sprintf("order=%s", bootDvice), CiCustom: cicustom, Cores: hardware.CPU, + Cpu: hardware.CPUType, CpuLimit: hardware.CPULimit, Description: options.Description, HugePages: options.HugePages.String(), diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachines.yaml index 65944e9..1c8ea51 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachines.yaml @@ -247,6 +247,9 @@ spec: Defaults to 0. minimum: 0 type: integer + cpuType: + description: Emulated CPU Type. Defaults to kvm64 + type: string disk: default: 50G description: hard disk size diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachinetemplates.yaml index f47a2c0..312207d 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachinetemplates.yaml @@ -264,6 +264,9 @@ spec: no CPU limit. Defaults to 0. minimum: 0 type: integer + cpuType: + description: Emulated CPU Type. Defaults to kvm64 + type: string disk: default: 50G description: hard disk size