From c3b51423c3c373cc8547199cea4d149f4a525b28 Mon Sep 17 00:00:00 2001 From: Mara Sophie Grosch Date: Mon, 6 May 2024 14:53:37 +0200 Subject: [PATCH] Anexia: allow to specify CPU performance type --- examples/anexia-machinedeployment.yaml | 5 +++++ pkg/cloudprovider/provider/anexia/provider.go | 4 ++++ pkg/cloudprovider/provider/anexia/types/types.go | 5 +++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/anexia-machinedeployment.yaml b/examples/anexia-machinedeployment.yaml index 3affb6ab9..f1366e358 100644 --- a/examples/anexia-machinedeployment.yaml +++ b/examples/anexia-machinedeployment.yaml @@ -39,6 +39,11 @@ spec: cpus: 2 memory: 2048 + # this defaults to "performance", but you can set anything + # supported by the Anexia Engine here - or not set this attribute + # at all + cpuPerformanceType: standard + disks: - size: 60 performanceType: ENT6 diff --git a/pkg/cloudprovider/provider/anexia/provider.go b/pkg/cloudprovider/provider/anexia/provider.go index 921dd0b90..c989dcdc7 100644 --- a/pkg/cloudprovider/provider/anexia/provider.go +++ b/pkg/cloudprovider/provider/anexia/provider.go @@ -162,6 +162,10 @@ func provisionVM(ctx context.Context, log *zap.SugaredLogger, client anxclient.C vm.DiskType = config.Disks[0].PerformanceType + if config.CPUPerformanceType != "" { + vm.CPUPerformanceType = config.CPUPerformanceType + } + for _, disk := range config.Disks[1:] { vm.AdditionalDisks = append(vm.AdditionalDisks, anxvm.AdditionalDisk{ SizeGBs: disk.Size, diff --git a/pkg/cloudprovider/provider/anexia/types/types.go b/pkg/cloudprovider/provider/anexia/types/types.go index f97a5389a..04cb2c992 100644 --- a/pkg/cloudprovider/provider/anexia/types/types.go +++ b/pkg/cloudprovider/provider/anexia/types/types.go @@ -63,8 +63,9 @@ type RawConfig struct { Template providerconfigtypes.ConfigVarString `json:"template"` TemplateBuild providerconfigtypes.ConfigVarString `json:"templateBuild"` - CPUs int `json:"cpus"` - Memory int `json:"memory"` + CPUs int `json:"cpus"` + CPUPerformanceType string `json:"cpuPerformanceType"` + Memory int `json:"memory"` // Deprecated, use Disks instead. DiskSize int `json:"diskSize"`