From 0ab8ffc4a6eff7f950513fcf6e16c932a80011ef Mon Sep 17 00:00:00 2001
From: "Kistner, Dominic"
machineTypes
+
+
+[]MachineType
+
+
+MachineTypes is a list of machine types complete with provider specific information.
+ID is the VM image ID
+acceleratedNetworking
+
+bool
+
+AcceleratedNetworking is an indicator if the image supports Azure accelerated networking.
+ID is the Shared Image Gallery image id.
+acceleratedNetworking
+
+bool
+
+AcceleratedNetworking is an indicator if the image supports Azure accelerated networking.
++(Appears on: +CloudProfileConfig) +
++
MachineType contains provider specific information to a machine type.
+ +Field | +Description | +
---|---|
+name
+
+string
+
+ |
+
+ Name is the name of the machine type. + |
+
+acceleratedNetworking
+
+bool
+
+ |
+
+(Optional)
+ AcceleratedNetworking is an indicator if the machine type supports Azure accelerated networking. + |
+
diff --git a/pkg/apis/azure/helper/helper.go b/pkg/apis/azure/helper/helper.go index 6a3869320..e94d1f9a9 100644 --- a/pkg/apis/azure/helper/helper.go +++ b/pkg/apis/azure/helper/helper.go @@ -102,10 +102,11 @@ func FindImageFromCloudProfile(cloudProfileConfig *api.CloudProfileConfig, image for _, version := range machineImage.Versions { if imageVersion == version.Version { return &api.MachineImage{ - Name: imageName, - Version: version.Version, - URN: version.URN, - ID: version.ID, + Name: imageName, + Version: version.Version, + URN: version.URN, + ID: version.ID, + AcceleratedNetworking: version.AcceleratedNetworking, }, nil } } diff --git a/pkg/apis/azure/helper/helper_test.go b/pkg/apis/azure/helper/helper_test.go index 9d9ec502f..7259b01d5 100644 --- a/pkg/apis/azure/helper/helper_test.go +++ b/pkg/apis/azure/helper/helper_test.go @@ -34,6 +34,8 @@ var _ = Describe("Helper", func() { purposeWrong api.Purpose = "baz" urn string = "publisher:offer:sku:version" imageID string = "/image/id" + boolTrue = true + boolFalse = false ) DescribeTable("#FindSubnetByPurpose", @@ -96,6 +98,8 @@ var _ = Describe("Helper", func() { Entry("entry not found (no version)", []api.MachineImage{{Name: "bar", Version: "1.2.3", URN: &urn}}, "bar", "1.2.4", nil, true), Entry("entry exists(urn)", []api.MachineImage{{Name: "bar", Version: "1.2.3", URN: &urn}}, "bar", "1.2.3", &api.MachineImage{Name: "bar", Version: "1.2.3", URN: &urn}, false), Entry("entry exists(id)", []api.MachineImage{{Name: "bar", Version: "1.2.3", ID: &imageID}}, "bar", "1.2.3", &api.MachineImage{Name: "bar", Version: "1.2.3", ID: &imageID}, false), + Entry("entry exists(accelerated networking active)", []api.MachineImage{{Name: "bar", Version: "1.2.3", URN: &urn, AcceleratedNetworking: &boolTrue}}, "bar", "1.2.3", &api.MachineImage{Name: "bar", Version: "1.2.3", URN: &urn, AcceleratedNetworking: &boolTrue}, false), + Entry("entry exists(accelerated networking inactive)", []api.MachineImage{{Name: "bar", Version: "1.2.3", URN: &urn, AcceleratedNetworking: &boolFalse}}, "bar", "1.2.3", &api.MachineImage{Name: "bar", Version: "1.2.3", URN: &urn, AcceleratedNetworking: &boolFalse}, false), ) DescribeTable("#FindDomainCountByRegion", diff --git a/pkg/apis/azure/types_cloudprofile.go b/pkg/apis/azure/types_cloudprofile.go index 6422e7b02..9d932b620 100644 --- a/pkg/apis/azure/types_cloudprofile.go +++ b/pkg/apis/azure/types_cloudprofile.go @@ -31,6 +31,8 @@ type CloudProfileConfig struct { // MachineImages is the list of machine images that are understood by the controller. It maps // logical names and versions to provider-specific identifiers. MachineImages []MachineImages + // MachineTypes is a list of machine types complete with provider specific information. + MachineTypes []MachineType } // DomainCount defines the region and the count for this domain count value. @@ -57,4 +59,14 @@ type MachineImageVersion struct { URN *string // ID is the Shared Image Gallery image id. ID *string + // AcceleratedNetworking is an indicator if the image supports Azure accelerated networking. + AcceleratedNetworking *bool +} + +// MachineType contains provider specific information to a machine type. +type MachineType struct { + // Name is the name of the machine type. + Name string + // AcceleratedNetworking is an indicator if the machine type supports Azure accelerated networking. + AcceleratedNetworking *bool } diff --git a/pkg/apis/azure/types_worker.go b/pkg/apis/azure/types_worker.go index 506c257a8..b79eb6d2f 100644 --- a/pkg/apis/azure/types_worker.go +++ b/pkg/apis/azure/types_worker.go @@ -42,4 +42,6 @@ type MachineImage struct { URN *string // ID is the VM image ID ID *string + // AcceleratedNetworking is an indicator if the image supports Azure accelerated networking. + AcceleratedNetworking *bool } diff --git a/pkg/apis/azure/v1alpha1/types_cloudprofile.go b/pkg/apis/azure/v1alpha1/types_cloudprofile.go index 47ce5234f..60f74e267 100644 --- a/pkg/apis/azure/v1alpha1/types_cloudprofile.go +++ b/pkg/apis/azure/v1alpha1/types_cloudprofile.go @@ -32,6 +32,9 @@ type CloudProfileConfig struct { // MachineImages is the list of machine images that are understood by the controller. It maps // logical names and versions to provider-specific identifiers. MachineImages []MachineImages `json:"machineImages"` + // MachineTypes is a list of machine types complete with provider specific information. + // +optional + MachineTypes []MachineType `json:"machineTypes,omitempty"` } // DomainCount defines the region and the count for this domain count value. @@ -60,4 +63,16 @@ type MachineImageVersion struct { // ID is the Shared Image Gallery image id. // +optional ID *string `json:"id,omitempty"` + // AcceleratedNetworking is an indicator if the image supports Azure accelerated networking. + // +optional + AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"` +} + +// MachineType contains provider specific information to a machine type. +type MachineType struct { + // Name is the name of the machine type. + Name string `json:"name"` + // AcceleratedNetworking is an indicator if the machine type supports Azure accelerated networking. + // +optional + AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"` } diff --git a/pkg/apis/azure/v1alpha1/types_worker.go b/pkg/apis/azure/v1alpha1/types_worker.go index 18c60a955..086dc68ee 100644 --- a/pkg/apis/azure/v1alpha1/types_worker.go +++ b/pkg/apis/azure/v1alpha1/types_worker.go @@ -46,4 +46,7 @@ type MachineImage struct { // ID is the VM image ID // +optional ID *string `json:"id,omitempty"` + // AcceleratedNetworking is an indicator if the image supports Azure accelerated networking. + // +optional + AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"` } diff --git a/pkg/apis/azure/v1alpha1/zz_generated.conversion.go b/pkg/apis/azure/v1alpha1/zz_generated.conversion.go index 30ed86a15..8f1922554 100644 --- a/pkg/apis/azure/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/azure/v1alpha1/zz_generated.conversion.go @@ -155,6 +155,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*MachineType)(nil), (*azure.MachineType)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_MachineType_To_azure_MachineType(a.(*MachineType), b.(*azure.MachineType), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*azure.MachineType)(nil), (*MachineType)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_azure_MachineType_To_v1alpha1_MachineType(a.(*azure.MachineType), b.(*MachineType), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*NatGatewayConfig)(nil), (*azure.NatGatewayConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_NatGatewayConfig_To_azure_NatGatewayConfig(a.(*NatGatewayConfig), b.(*azure.NatGatewayConfig), scope) }); err != nil { @@ -306,6 +316,7 @@ func autoConvert_v1alpha1_CloudProfileConfig_To_azure_CloudProfileConfig(in *Clo out.CountUpdateDomains = *(*[]azure.DomainCount)(unsafe.Pointer(&in.CountUpdateDomains)) out.CountFaultDomains = *(*[]azure.DomainCount)(unsafe.Pointer(&in.CountFaultDomains)) out.MachineImages = *(*[]azure.MachineImages)(unsafe.Pointer(&in.MachineImages)) + out.MachineTypes = *(*[]azure.MachineType)(unsafe.Pointer(&in.MachineTypes)) return nil } @@ -318,6 +329,7 @@ func autoConvert_azure_CloudProfileConfig_To_v1alpha1_CloudProfileConfig(in *azu out.CountUpdateDomains = *(*[]DomainCount)(unsafe.Pointer(&in.CountUpdateDomains)) out.CountFaultDomains = *(*[]DomainCount)(unsafe.Pointer(&in.CountFaultDomains)) out.MachineImages = *(*[]MachineImages)(unsafe.Pointer(&in.MachineImages)) + out.MachineTypes = *(*[]MachineType)(unsafe.Pointer(&in.MachineTypes)) return nil } @@ -491,6 +503,7 @@ func autoConvert_v1alpha1_MachineImage_To_azure_MachineImage(in *MachineImage, o out.Version = in.Version out.URN = (*string)(unsafe.Pointer(in.URN)) out.ID = (*string)(unsafe.Pointer(in.ID)) + out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) return nil } @@ -504,6 +517,7 @@ func autoConvert_azure_MachineImage_To_v1alpha1_MachineImage(in *azure.MachineIm out.Version = in.Version out.URN = (*string)(unsafe.Pointer(in.URN)) out.ID = (*string)(unsafe.Pointer(in.ID)) + out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) return nil } @@ -516,6 +530,7 @@ func autoConvert_v1alpha1_MachineImageVersion_To_azure_MachineImageVersion(in *M out.Version = in.Version out.URN = (*string)(unsafe.Pointer(in.URN)) out.ID = (*string)(unsafe.Pointer(in.ID)) + out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) return nil } @@ -528,6 +543,7 @@ func autoConvert_azure_MachineImageVersion_To_v1alpha1_MachineImageVersion(in *a out.Version = in.Version out.URN = (*string)(unsafe.Pointer(in.URN)) out.ID = (*string)(unsafe.Pointer(in.ID)) + out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) return nil } @@ -558,6 +574,28 @@ func Convert_azure_MachineImages_To_v1alpha1_MachineImages(in *azure.MachineImag return autoConvert_azure_MachineImages_To_v1alpha1_MachineImages(in, out, s) } +func autoConvert_v1alpha1_MachineType_To_azure_MachineType(in *MachineType, out *azure.MachineType, s conversion.Scope) error { + out.Name = in.Name + out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) + return nil +} + +// Convert_v1alpha1_MachineType_To_azure_MachineType is an autogenerated conversion function. +func Convert_v1alpha1_MachineType_To_azure_MachineType(in *MachineType, out *azure.MachineType, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineType_To_azure_MachineType(in, out, s) +} + +func autoConvert_azure_MachineType_To_v1alpha1_MachineType(in *azure.MachineType, out *MachineType, s conversion.Scope) error { + out.Name = in.Name + out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) + return nil +} + +// Convert_azure_MachineType_To_v1alpha1_MachineType is an autogenerated conversion function. +func Convert_azure_MachineType_To_v1alpha1_MachineType(in *azure.MachineType, out *MachineType, s conversion.Scope) error { + return autoConvert_azure_MachineType_To_v1alpha1_MachineType(in, out, s) +} + func autoConvert_v1alpha1_NatGatewayConfig_To_azure_NatGatewayConfig(in *NatGatewayConfig, out *azure.NatGatewayConfig, s conversion.Scope) error { out.Enabled = in.Enabled return nil diff --git a/pkg/apis/azure/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/azure/v1alpha1/zz_generated.deepcopy.go index 7498ed217..f79e76c69 100644 --- a/pkg/apis/azure/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/azure/v1alpha1/zz_generated.deepcopy.go @@ -84,6 +84,13 @@ func (in *CloudProfileConfig) DeepCopyInto(out *CloudProfileConfig) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.MachineTypes != nil { + in, out := &in.MachineTypes, &out.MachineTypes + *out = make([]MachineType, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -284,6 +291,11 @@ func (in *MachineImage) DeepCopyInto(out *MachineImage) { *out = new(string) **out = **in } + if in.AcceleratedNetworking != nil { + in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking + *out = new(bool) + **out = **in + } return } @@ -310,6 +322,11 @@ func (in *MachineImageVersion) DeepCopyInto(out *MachineImageVersion) { *out = new(string) **out = **in } + if in.AcceleratedNetworking != nil { + in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking + *out = new(bool) + **out = **in + } return } @@ -346,6 +363,27 @@ func (in *MachineImages) DeepCopy() *MachineImages { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineType) DeepCopyInto(out *MachineType) { + *out = *in + if in.AcceleratedNetworking != nil { + in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking + *out = new(bool) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineType. +func (in *MachineType) DeepCopy() *MachineType { + if in == nil { + return nil + } + out := new(MachineType) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NatGatewayConfig) DeepCopyInto(out *NatGatewayConfig) { *out = *in diff --git a/pkg/apis/azure/zz_generated.deepcopy.go b/pkg/apis/azure/zz_generated.deepcopy.go index d4be231a1..a737a4305 100644 --- a/pkg/apis/azure/zz_generated.deepcopy.go +++ b/pkg/apis/azure/zz_generated.deepcopy.go @@ -84,6 +84,13 @@ func (in *CloudProfileConfig) DeepCopyInto(out *CloudProfileConfig) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.MachineTypes != nil { + in, out := &in.MachineTypes, &out.MachineTypes + *out = make([]MachineType, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -284,6 +291,11 @@ func (in *MachineImage) DeepCopyInto(out *MachineImage) { *out = new(string) **out = **in } + if in.AcceleratedNetworking != nil { + in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking + *out = new(bool) + **out = **in + } return } @@ -310,6 +322,11 @@ func (in *MachineImageVersion) DeepCopyInto(out *MachineImageVersion) { *out = new(string) **out = **in } + if in.AcceleratedNetworking != nil { + in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking + *out = new(bool) + **out = **in + } return } @@ -346,6 +363,27 @@ func (in *MachineImages) DeepCopy() *MachineImages { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineType) DeepCopyInto(out *MachineType) { + *out = *in + if in.AcceleratedNetworking != nil { + in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking + *out = new(bool) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineType. +func (in *MachineType) DeepCopy() *MachineType { + if in == nil { + return nil + } + out := new(MachineType) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NatGatewayConfig) DeepCopyInto(out *NatGatewayConfig) { *out = *in diff --git a/pkg/controller/worker/machine_images.go b/pkg/controller/worker/machine_images.go index 108624630..3f863fdf3 100644 --- a/pkg/controller/worker/machine_images.go +++ b/pkg/controller/worker/machine_images.go @@ -61,28 +61,28 @@ func (w *workerDelegate) GetMachineImages(ctx context.Context) (runtime.Object, return workerStatusV1alpha1, nil } -func (w *workerDelegate) findMachineImage(name, version string) (urn, id *string, err error) { +func (w *workerDelegate) findMachineImage(name, version string) (urn, id *string, acceleratedNetworking *bool, err error) { machineImage, err := helper.FindImageFromCloudProfile(w.cloudProfileConfig, name, version) if err == nil { - return machineImage.URN, machineImage.ID, nil + return machineImage.URN, machineImage.ID, machineImage.AcceleratedNetworking, nil } // Try to look up machine image in worker provider status as it was not found in componentconfig. if providerStatus := w.worker.Status.ProviderStatus; providerStatus != nil { workerStatus := &api.WorkerStatus{} if _, _, err := w.Decoder().Decode(providerStatus.Raw, nil, workerStatus); err != nil { - return nil, nil, errors.Wrapf(err, "could not decode worker status of worker '%s'", util.ObjectName(w.worker)) + return nil, nil, nil, errors.Wrapf(err, "could not decode worker status of worker '%s'", util.ObjectName(w.worker)) } machineImage, err := helper.FindMachineImage(workerStatus.MachineImages, name, version) if err != nil { - return nil, nil, worker.ErrorMachineImageNotFound(name, version) + return nil, nil, nil, worker.ErrorMachineImageNotFound(name, version) } - return machineImage.URN, machineImage.ID, nil + return machineImage.URN, machineImage.ID, machineImage.AcceleratedNetworking, nil } - return nil, nil, worker.ErrorMachineImageNotFound(name, version) + return nil, nil, nil, worker.ErrorMachineImageNotFound(name, version) } func appendMachineImage(machineImages []api.MachineImage, machineImage api.MachineImage) []api.MachineImage { diff --git a/pkg/controller/worker/machines.go b/pkg/controller/worker/machines.go index e51abd471..c7c202ad4 100644 --- a/pkg/controller/worker/machines.go +++ b/pkg/controller/worker/machines.go @@ -124,15 +124,16 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { return err } - urn, id, err := w.findMachineImage(pool.MachineImage.Name, pool.MachineImage.Version) + urn, id, imageSupportAcceleratedNetworking, err := w.findMachineImage(pool.MachineImage.Name, pool.MachineImage.Version) if err != nil { return err } machineImages = appendMachineImage(machineImages, apisazure.MachineImage{ - Name: pool.MachineImage.Name, - Version: pool.MachineImage.Version, - URN: urn, - ID: id, + Name: pool.MachineImage.Name, + Version: pool.MachineImage.Version, + URN: urn, + ID: id, + AcceleratedNetworking: imageSupportAcceleratedNetworking, }) volumeSize, err := worker.DiskSize(pool.Volume.Size) @@ -174,12 +175,13 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { Annotations: pool.Annotations, Taints: pool.Taints, } - + networkConfig = map[string]interface{}{ + "vnet": infrastructureStatus.Networks.VNet.Name, + "subnet": nodesSubnet.Name, + } machineClassSpec = map[string]interface{}{ "region": w.worker.Spec.Region, "resourceGroup": infrastructureStatus.ResourceGroup.Name, - "vnetName": infrastructureStatus.Networks.VNet.Name, - "subnetName": nodesSubnet.Name, "tags": map[string]interface{}{ "Name": w.worker.Namespace, fmt.Sprintf("kubernetes.io-cluster-%s", w.worker.Namespace): "1", @@ -198,12 +200,16 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { machineClassSpec["vnetResourceGroup"] = *infrastructureStatus.Networks.VNet.ResourceGroup } + if imageSupportAcceleratedNetworking != nil && *imageSupportAcceleratedNetworking && w.isMachineTypeSupportingAcceleratedNetworking(pool.MachineType) { + networkConfig["acceleratedNetworking"] = true + } + machineClassSpec["network"] = networkConfig + if zone != nil { machineDeployment.Minimum = worker.DistributeOverZones(zone.index, pool.Minimum, zone.count) machineDeployment.Maximum = worker.DistributeOverZones(zone.index, pool.Maximum, zone.count) machineDeployment.MaxSurge = worker.DistributePositiveIntOrPercent(zone.index, pool.MaxSurge, zone.count, pool.Maximum) machineDeployment.MaxUnavailable = worker.DistributePositiveIntOrPercent(zone.index, pool.MaxUnavailable, zone.count, pool.Minimum) - machineClassSpec["zone"] = zone.name } if availabilitySetID != nil { @@ -268,3 +274,13 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { return nil } + +// isMachineTypeSupportingAcceleratedNetworking checks if the passed machine type is supporting Azure accelerated networking. +func (w *workerDelegate) isMachineTypeSupportingAcceleratedNetworking(machineTypeName string) bool { + for _, machType := range w.cloudProfileConfig.MachineTypes { + if machType.Name == machineTypeName && machType.AcceleratedNetworking != nil && *machType.AcceleratedNetworking { + return true + } + } + return false +} diff --git a/pkg/controller/worker/machines_test.go b/pkg/controller/worker/machines_test.go index 0dcdfdbd1..388c0b676 100644 --- a/pkg/controller/worker/machines_test.go +++ b/pkg/controller/worker/machines_test.go @@ -84,7 +84,6 @@ var _ = Describe("Machines", func() { var ( namespace string cloudProfileName string - identityID = "identity-id" azureClientID string azureClientSecret string @@ -102,6 +101,7 @@ var _ = Describe("Machines", func() { vnetName string subnetName string availabilitySetID string + identityID string machineType string userData []byte volumeSize int @@ -129,6 +129,8 @@ var _ = Describe("Machines", func() { clusterWithoutImages *extensionscontroller.Cluster cluster *extensionscontroller.Cluster w *extensionsv1alpha1.Worker + + boolTrue = true ) BeforeEach(func() { @@ -155,6 +157,7 @@ var _ = Describe("Machines", func() { userData = []byte("some-user-data") volumeSize = 20 sshKey = "public-key" + identityID = "identity-id" namePool1 = "pool-1" minPool1 = 5 @@ -180,7 +183,6 @@ var _ = Describe("Machines", func() { }, }, } - cloudProfileConfig := &apiv1alpha1.CloudProfileConfig{ TypeMeta: metav1.TypeMeta{ APIVersion: apiv1alpha1.SchemeGroupVersion.String(), @@ -191,8 +193,9 @@ var _ = Describe("Machines", func() { Name: machineImageName, Versions: []apiv1alpha1.MachineImageVersion{ apiv1alpha1.MachineImageVersion{ - Version: machineImageVersion, - URN: &machineImageURN, + Version: machineImageVersion, + URN: &machineImageURN, + AcceleratedNetworking: &boolTrue, }, apiv1alpha1.MachineImageVersion{ Version: machineImageVersionID, @@ -201,6 +204,12 @@ var _ = Describe("Machines", func() { }, }, }, + MachineTypes: []apiv1alpha1.MachineType{ + apiv1alpha1.MachineType{ + Name: machineType, + AcceleratedNetworking: &boolTrue, + }, + }, } cloudProfileConfigJSON, _ := json.Marshal(cloudProfileConfig) cluster = &extensionscontroller.Cluster{ @@ -315,10 +324,13 @@ var _ = Describe("Machines", func() { BeforeEach(func() { defaultMachineClass := map[string]interface{}{ - "region": region, - "resourceGroup": resourceGroupName, - "vnetName": vnetName, - "subnetName": subnetName, + "region": region, + "resourceGroup": resourceGroupName, + "network": map[string]interface{}{ + "vnet": vnetName, + "subnet": subnetName, + "acceleratedNetworking": true, + }, "availabilitySetID": availabilitySetID, "tags": map[string]interface{}{ "Name": namespace, @@ -341,6 +353,10 @@ var _ = Describe("Machines", func() { "urn": machineImageURN, } + defaultMachineClass["network"] = map[string]interface{}{ + "vnet": vnetName, + "subnet": subnetName, + } imageIdMachineClass = copyMachineClass(defaultMachineClass) imageIdMachineClass["image"] = map[string]interface{}{ "id": machineImageID, @@ -408,9 +424,10 @@ var _ = Describe("Machines", func() { }, MachineImages: []apiv1alpha1.MachineImage{ { - Name: machineImageName, - Version: machineImageVersion, - URN: &machineImageURN, + Name: machineImageName, + Version: machineImageVersion, + URN: &machineImageURN, + AcceleratedNetworking: &boolTrue, }, { Name: machineImageName, @@ -430,9 +447,7 @@ var _ = Describe("Machines", func() { }) It("should fail because the secret cannot be read", func() { - c.EXPECT(). - Get(context.TODO(), gomock.Any(), gomock.AssignableToTypeOf(&corev1.Secret{})). - Return(fmt.Errorf("error")) + c.EXPECT().Get(context.TODO(), gomock.Any(), gomock.AssignableToTypeOf(&corev1.Secret{})).Return(fmt.Errorf("error")) result, err := workerDelegate.GenerateMachineDeployments(context.TODO()) Expect(err).To(HaveOccurred())