diff --git a/api/v1beta1/azurestackhcimachine_types.go b/api/v1beta1/azurestackhcimachine_types.go index dcbcccc5..4865c42c 100644 --- a/api/v1beta1/azurestackhcimachine_types.go +++ b/api/v1beta1/azurestackhcimachine_types.go @@ -53,6 +53,10 @@ type AzureStackHCIMachineSpec struct { GpuCount int32 `json:"gpuCount,omitempty"` + // VM cpu/memory/GPU details when VM size type is custom + // +optional + CustomSize VirtualMachineCustomSize `json:"customSize,omitempty"` + // AllocatePublicIP allows the ability to create dynamic public ips for machines where this value is true. // +optional AllocatePublicIP bool `json:"allocatePublicIP,omitempty"` diff --git a/api/v1beta1/azurestackhcivirtualmachine_types.go b/api/v1beta1/azurestackhcivirtualmachine_types.go index 923b3108..0d1d70fc 100644 --- a/api/v1beta1/azurestackhcivirtualmachine_types.go +++ b/api/v1beta1/azurestackhcivirtualmachine_types.go @@ -46,6 +46,10 @@ type AzureStackHCIVirtualMachineSpec struct { // if not specified, it's a vm without gpu GpuCount int32 `json:"gpuCount,omitempty"` + // VM cpu/memory/GPU details when VM size type is custom + // +optional + CustomSize VirtualMachineCustomSize `json:"customSize,omitempty"` + // come from the cluster scope for machine and lb controller creation path ResourceGroup string `json:"resourceGroup"` VnetName string `json:"vnetName"` diff --git a/api/v1beta1/types.go b/api/v1beta1/types.go index 12f24543..f0a22334 100644 --- a/api/v1beta1/types.go +++ b/api/v1beta1/types.go @@ -216,6 +216,32 @@ type AvailabilityZone struct { Enabled *bool `json:"enabled,omitempty"` } +// VirtualMachineCustomSize specifies cpu/memory/gpu information for custom VMSize types. +type VirtualMachineCustomSize struct { + CpuCount *int32 `json:"cpucount,omitempty"` + MemoryMB *int32 `json:"memorymb,omitempty"` + Assignment *GpuAssignment `json:"assignment,omitempty"` + PartitionSizeMB *uint64 `json:"partitionSizeMB,omitempty"` + GpuName *string `json:"gpuName,omitempty"` + GpuDriver *string `json:"gpuDriver,omitempty"` + MMIORegion *GpuMemoryMappedIORegion `json:"mmioRegion,omitempty"` +} + +type GpuAssignment string + +// possible values of gpu assignment +const ( + GpuDDA GpuAssignment = "GpuDDA" + GpuP GpuAssignment = "GpuP" + GpuPV GpuAssignment = "GpuPV" + GpuDefault GpuAssignment = "GpuDefault" +) + +type GpuMemoryMappedIORegion struct { + Low *uint64 `json:"low,omitempty"` + High *uint64 `json:"high,omitempty"` +} + // VMIdentity defines the identity of the virtual machine, if configured. type VMIdentity string diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 6404f2cb..672a4df2 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -451,6 +451,7 @@ func (in *AzureStackHCIMachineSpec) DeepCopyInto(out *AzureStackHCIMachineSpec) in.AvailabilityZone.DeepCopyInto(&out.AvailabilityZone) in.Image.DeepCopyInto(&out.Image) out.OSDisk = in.OSDisk + in.CustomSize.DeepCopyInto(&out.CustomSize) if in.AdditionalSSHKeys != nil { in, out := &in.AdditionalSSHKeys, &out.AdditionalSSHKeys *out = make([]string, len(*in)) @@ -701,6 +702,7 @@ func (in *AzureStackHCIVirtualMachineSpec) DeepCopyInto(out *AzureStackHCIVirtua *out = new(string) **out = **in } + in.CustomSize.DeepCopyInto(&out.CustomSize) if in.BackendPoolNames != nil { in, out := &in.BackendPoolNames, &out.BackendPoolNames *out = make([]string, len(*in)) @@ -776,6 +778,31 @@ func (in *AzureStackHCIVirtualMachineStatus) DeepCopy() *AzureStackHCIVirtualMac return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GpuMemoryMappedIORegion) DeepCopyInto(out *GpuMemoryMappedIORegion) { + *out = *in + if in.Low != nil { + in, out := &in.Low, &out.Low + *out = new(uint64) + **out = **in + } + if in.High != nil { + in, out := &in.High, &out.High + *out = new(uint64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GpuMemoryMappedIORegion. +func (in *GpuMemoryMappedIORegion) DeepCopy() *GpuMemoryMappedIORegion { + if in == nil { + return nil + } + out := new(GpuMemoryMappedIORegion) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Image) DeepCopyInto(out *Image) { *out = *in @@ -1042,6 +1069,56 @@ func (in *VM) DeepCopy() *VM { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualMachineCustomSize) DeepCopyInto(out *VirtualMachineCustomSize) { + *out = *in + if in.CpuCount != nil { + in, out := &in.CpuCount, &out.CpuCount + *out = new(int32) + **out = **in + } + if in.MemoryMB != nil { + in, out := &in.MemoryMB, &out.MemoryMB + *out = new(int32) + **out = **in + } + if in.Assignment != nil { + in, out := &in.Assignment, &out.Assignment + *out = new(GpuAssignment) + **out = **in + } + if in.PartitionSizeMB != nil { + in, out := &in.PartitionSizeMB, &out.PartitionSizeMB + *out = new(uint64) + **out = **in + } + if in.GpuName != nil { + in, out := &in.GpuName, &out.GpuName + *out = new(string) + **out = **in + } + if in.GpuDriver != nil { + in, out := &in.GpuDriver, &out.GpuDriver + *out = new(string) + **out = **in + } + if in.MMIORegion != nil { + in, out := &in.MMIORegion, &out.MMIORegion + *out = new(GpuMemoryMappedIORegion) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineCustomSize. +func (in *VirtualMachineCustomSize) DeepCopy() *VirtualMachineCustomSize { + if in == nil { + return nil + } + out := new(VirtualMachineCustomSize) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in VirtualMachinesByCreationTimestamp) DeepCopyInto(out *VirtualMachinesByCreationTimestamp) { { diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml index 22c65e59..d874a91c 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml @@ -59,6 +59,34 @@ spec: id: type: string type: object + customSize: + description: VM cpu/memory/GPU details when VM size type is custom + properties: + assignment: + type: string + cpucount: + format: int32 + type: integer + gpuDriver: + type: string + gpuName: + type: string + memorymb: + format: int32 + type: integer + mmioRegion: + properties: + high: + format: int64 + type: integer + low: + format: int64 + type: integer + type: object + partitionSizeMB: + format: int64 + type: integer + type: object gpuCount: format: int32 type: integer diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml index b8f68ad0..91e65d88 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml @@ -68,6 +68,35 @@ spec: id: type: string type: object + customSize: + description: VM cpu/memory/GPU details when VM size type is + custom + properties: + assignment: + type: string + cpucount: + format: int32 + type: integer + gpuDriver: + type: string + gpuName: + type: string + memorymb: + format: int32 + type: integer + mmioRegion: + properties: + high: + format: int64 + type: integer + low: + format: int64 + type: integer + type: object + partitionSizeMB: + format: int64 + type: integer + type: object gpuCount: format: int32 type: integer diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml index 884ee31c..8b61ea0b 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml @@ -64,6 +64,34 @@ spec: type: string clusterName: type: string + customSize: + description: VM cpu/memory/GPU details when VM size type is custom + properties: + assignment: + type: string + cpucount: + format: int32 + type: integer + gpuDriver: + type: string + gpuName: + type: string + memorymb: + format: int32 + type: integer + mmioRegion: + properties: + high: + format: int64 + type: integer + low: + format: int64 + type: integer + type: object + partitionSizeMB: + format: int64 + type: integer + type: object gpuCount: description: if not specified, it's a vm without gpu format: int32