diff --git a/Makefile b/Makefile index 283d961f..c17f944a 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ ETCD=$(TOOLS_BIN_DIR)/etcd # Version MAJOR_VER ?= 0 MINOR_VER ?= 3 -PATCH_VER ?= 9-alpha +PATCH_VER ?= 10-alpha # Define Docker related variables. Releases should modify and double check these vars. REGISTRY ?= mocimages.azurecr.io diff --git a/api/v1alpha3/azurestackhcimachine_types.go b/api/v1alpha3/azurestackhcimachine_types.go index 70170b20..949c8f9e 100644 --- a/api/v1alpha3/azurestackhcimachine_types.go +++ b/api/v1alpha3/azurestackhcimachine_types.go @@ -37,6 +37,7 @@ type AzureStackHCIMachineSpec struct { ProviderID *string `json:"providerID,omitempty"` VMSize string `json:"vmSize"` + CustomSize VirtualMachineCustomSize `json:"customSize,omitempty"` AvailabilityZone AvailabilityZone `json:"availabilityZone,omitempty"` diff --git a/api/v1alpha3/azurestackhcivirtualmachine_types.go b/api/v1alpha3/azurestackhcivirtualmachine_types.go index a55eb059..ebe71554 100644 --- a/api/v1alpha3/azurestackhcivirtualmachine_types.go +++ b/api/v1alpha3/azurestackhcivirtualmachine_types.go @@ -32,14 +32,15 @@ const ( // AzureStackHCIVirtualMachineSpec defines the desired state of AzureStackHCIVirtualMachine type AzureStackHCIVirtualMachineSpec struct { - VMSize string `json:"vmSize"` - AvailabilityZone AvailabilityZone `json:"availabilityZone,omitempty"` - Image Image `json:"image"` - OSDisk OSDisk `json:"osDisk,omitempty"` - BootstrapData *string `json:"bootstrapData,omitempty"` - Identity VMIdentity `json:"identity,omitempty"` - Location string `json:"location"` // does location belong here? - SSHPublicKey string `json:"sshPublicKey"` + VMSize string `json:"vmSize"` + CustomSize VirtualMachineCustomSize `json:"customSize,omitempty"` + AvailabilityZone AvailabilityZone `json:"availabilityZone,omitempty"` + Image Image `json:"image"` + OSDisk OSDisk `json:"osDisk,omitempty"` + BootstrapData *string `json:"bootstrapData,omitempty"` + Identity VMIdentity `json:"identity,omitempty"` + Location string `json:"location"` // does location belong here? + SSHPublicKey string `json:"sshPublicKey"` // come from the cluster scope for machine and lb controller creation path ResourceGroup string `json:"resourceGroup"` diff --git a/api/v1alpha3/types.go b/api/v1alpha3/types.go index 721cdff1..69d3a7b7 100644 --- a/api/v1alpha3/types.go +++ b/api/v1alpha3/types.go @@ -129,6 +129,11 @@ var ( VMStateUpdating = VMState("Updating") ) +type VirtualMachineCustomSize struct { + CpuCount int32 `json:"cpuCount,omitempty"` + MemoryMB int32 `json:"memoryMB,omitempty"` +} + // VM describes an Azure virtual machine. type VM struct { ID string `json:"id,omitempty"` @@ -138,6 +143,7 @@ type VM struct { // Hardware profile VMSize string `json:"vmSize,omitempty"` + CustomSize VirtualMachineCustomSize `json:"customSize,omitempty"` // Storage profile Image Image `json:"image,omitempty"` diff --git a/cloud/services/virtualmachines/virtualmachines.go b/cloud/services/virtualmachines/virtualmachines.go index 1f8a40a6..b4523c06 100644 --- a/cloud/services/virtualmachines/virtualmachines.go +++ b/cloud/services/virtualmachines/virtualmachines.go @@ -47,7 +47,9 @@ type Spec struct { Name string NICName string SSHKeyData []string - Size string + VMSize string + CpuCount int32 + MemoryMB int32 Zone string Image infrav1.Image OSDisk infrav1.OSDisk @@ -154,7 +156,11 @@ func (s *Service) Reconcile(ctx context.Context, spec interface{}) error { }, VmType: vmSpec.VMType, HardwareProfile: &compute.HardwareProfile{ - VMSize: compute.VirtualMachineSizeTypes(vmSpec.Size), + VMSize: compute.VirtualMachineSizeTypes(vmSpec.VMSize), + CustomSize: &compute.VirtualMachineCustomSize{ + CpuCount: &vmSpec.CpuCount, + MemoryMB: &vmSpec.MemoryMB, + }, }, }, } diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclusters.yaml index b833de17..d4633704 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclusters.yaml @@ -255,6 +255,15 @@ spec: vmSize: description: Hardware profile type: string + customSize: + properties: + cpuCount: + format: int32 + type: integer + memoryMB: + format: int32 + type: integer + type: object vmState: description: State - The provisioning state, which only appears in the response. 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 1328b5ab..eb64dba3 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml @@ -123,6 +123,15 @@ spec: type: string vmSize: type: string + customSize: + properties: + cpuCount: + format: int32 + type: integer + memoryMB: + format: int32 + type: integer + type: object required: - location - sshPublicKey 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 d322148f..181f6fe1 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml @@ -134,6 +134,15 @@ spec: type: string vmSize: type: string + customSize: + properties: + cpuCount: + format: int32 + type: integer + memoryMB: + format: int32 + type: integer + type: object required: - location - sshPublicKey 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 ca6f50fa..08b9b435 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml @@ -134,6 +134,15 @@ spec: type: string vmSize: type: string + customSize: + properties: + cpuCount: + format: int32 + type: integer + memoryMB: + format: int32 + type: integer + type: object vnetName: type: string required: diff --git a/config/manager/manager_image_patch.yaml b/config/manager/manager_image_patch.yaml index 502af43b..b603d5aa 100644 --- a/config/manager/manager_image_patch.yaml +++ b/config/manager/manager_image_patch.yaml @@ -7,5 +7,5 @@ spec: template: spec: containers: - - image: mocimages.azurecr.io/caphcontroller:0.3.9-alpha + - image: mocimages.azurecr.io/caphcontroller:0.3.10-alpha name: manager diff --git a/controllers/azurestackhcimachine_controller.go b/controllers/azurestackhcimachine_controller.go index 4036389a..4d39b2db 100644 --- a/controllers/azurestackhcimachine_controller.go +++ b/controllers/azurestackhcimachine_controller.go @@ -300,6 +300,8 @@ func (r *AzureStackHCIMachineReconciler) reconcileVirtualMachineNormal(machineSc image.DeepCopyInto(&vm.Spec.Image) vm.Spec.VMSize = machineScope.AzureStackHCIMachine.Spec.VMSize + vm.Spec.CustomSize.CpuCount = machineScope.AzureStackHCIMachine.Spec.CustomSize.CpuCount + vm.Spec.CustomSize.MemoryMB = machineScope.AzureStackHCIMachine.Spec.CustomSize.MemoryMB machineScope.AzureStackHCIMachine.Spec.AvailabilityZone.DeepCopyInto(&vm.Spec.AvailabilityZone) machineScope.AzureStackHCIMachine.Spec.OSDisk.DeepCopyInto(&vm.Spec.OSDisk) vm.Spec.Location = machineScope.AzureStackHCIMachine.Spec.Location diff --git a/controllers/azurestackhcivirtualmachine_reconciler.go b/controllers/azurestackhcivirtualmachine_reconciler.go index 17bfc908..cb433e3a 100644 --- a/controllers/azurestackhcivirtualmachine_reconciler.go +++ b/controllers/azurestackhcivirtualmachine_reconciler.go @@ -216,7 +216,9 @@ func (s *azureStackHCIVirtualMachineService) createVirtualMachine(nicName string Name: s.vmScope.Name(), NICName: nicName, SSHKeyData: decodedKeys, - Size: s.vmScope.AzureStackHCIVirtualMachine.Spec.VMSize, + VMSize: s.vmScope.AzureStackHCIVirtualMachine.Spec.VMSize, + CpuCount: s.vmScope.AzureStackHCIVirtualMachine.Spec.CustomSize.CpuCount, + MemoryMB: s.vmScope.AzureStackHCIVirtualMachine.Spec.CustomSize.MemoryMB, OSDisk: s.vmScope.AzureStackHCIVirtualMachine.Spec.OSDisk, Image: s.vmScope.AzureStackHCIVirtualMachine.Spec.Image, CustomData: *s.vmScope.AzureStackHCIVirtualMachine.Spec.BootstrapData, diff --git a/templates/flavors/base/cluster-template.yaml b/templates/flavors/base/cluster-template.yaml index 99e939b5..c3bd2924 100644 --- a/templates/flavors/base/cluster-template.yaml +++ b/templates/flavors/base/cluster-template.yaml @@ -23,6 +23,9 @@ spec: osType: "Linux" location: "westus" vmSize: ${AZURESTACKHCI_CONTROL_PLANE_MACHINE_TYPE} + customSize: + cpuCount: ${AZURESTACKHCI_CONTROL_PLANE_MACHINE_TYPE_CPU_COUNT} + memoryMB: ${AZURESTACKHCI_CONTROL_PLANE_MACHINE_TYPE_MEMORY_MB} sshPublicKey: ${AZURESTACKHCI_SSH_PUBLIC_KEY:=""} --- apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 diff --git a/templates/flavors/mgmt/mgmt-machine.yaml b/templates/flavors/mgmt/mgmt-machine.yaml index c4b96c81..eb9c2dea 100644 --- a/templates/flavors/mgmt/mgmt-machine.yaml +++ b/templates/flavors/mgmt/mgmt-machine.yaml @@ -34,6 +34,9 @@ spec: providerID: moc://${CLUSTER_NAME}-control-plane-0 sshPublicKey: ${AZURESTACKHCI_SSH_PUBLIC_KEY:=""} vmSize: ${AZURESTACKHCI_CONTROL_PLANE_MACHINE_TYPE} + customSize: + cpuCount: ${AZURESTACKHCI_CONTROL_PLANE_MACHINE_TYPE_CPU_COUNT} + memoryMB: ${AZURESTACKHCI_CONTROL_PLANE_MACHINE_TYPE_MEMORY_MB} --- apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 kind: KubeadmConfig @@ -70,4 +73,4 @@ spec: cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' useExperimentalRetryJoin: true ---- \ No newline at end of file +---