From 3d2de4070d02e2da987b09833316da56bd5f2890 Mon Sep 17 00:00:00 2001 From: Vladimir Nachev Date: Thu, 28 May 2020 18:40:20 +0300 Subject: [PATCH] diable accelerated network for AvSet clusters --- docs/usage-as-end-user.md | 3 ++- pkg/controller/worker/machines.go | 18 +++++++++++------- pkg/controller/worker/machines_test.go | 12 +++--------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/docs/usage-as-end-user.md b/docs/usage-as-end-user.md index aefc5000a..7ff01df99 100644 --- a/docs/usage-as-end-user.md +++ b/docs/usage-as-end-user.md @@ -223,5 +223,6 @@ Shoot clusters with Kubernetes v1.18 or less will use the in-tree `kubernetes.io ### Azure Accelerated Networking All worker machines of the cluster will be automatically configured to use [Azure Accelerated Networking](https://docs.microsoft.com/en-us/azure/virtual-network/create-vm-accelerated-networking-cli) if the prerequisites are fulfilled. -The prerequisites are that the used machine type and operating system image version are compatible for Accelerated Networking. +The prerequisites are that the cluster must be zoned, and the used machine type and operating system image version are compatible for Accelerated Networking. +`Availability Set` based shoot clusters will not be enabled for accelerated networking even if the machine type and operating system support it, this is necessary because all machines from the availability set must be scheduled on special hardware, more daitls can be found [here](https://github.com/MicrosoftDocs/azure-docs/issues/10536). Supported machine types are listed in the CloudProfile in `.spec.providerConfig.machineTypes[].acceleratedNetworking` and the supported operating system image versions are defined in `.spec.providerConfig.machineImages[].versions[].acceleratedNetworking`. diff --git a/pkg/controller/worker/machines.go b/pkg/controller/worker/machines.go index 3fa38b060..8ba1f21b7 100644 --- a/pkg/controller/worker/machines.go +++ b/pkg/controller/worker/machines.go @@ -21,7 +21,6 @@ import ( "regexp" "strings" - apisazure "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" azureapi "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" azureapihelper "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/helper" "github.com/gardener/gardener-extension-provider-azure/pkg/azure" @@ -92,10 +91,11 @@ type zoneInfo struct { func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { var ( - machineDeployments = worker.MachineDeployments{} - machineClasses []map[string]interface{} - machineImages []apisazure.MachineImage - nodesAvailabilitySet *azureapi.AvailabilitySet + acceleratedNetworkAllowed = true + machineDeployments = worker.MachineDeployments{} + machineClasses []map[string]interface{} + machineImages []azureapi.MachineImage + nodesAvailabilitySet *azureapi.AvailabilitySet ) machineClassSecretData, err := w.generateMachineClassSecretData(ctx) @@ -119,6 +119,10 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { if err != nil { return err } + + // Do not enable accelerated networking for AvSet cluster. + // This is necessary to avoid `ExistingAvailabilitySetWasNotDeployedOnAcceleratedNetworkingEnabledCluster` error. + acceleratedNetworkAllowed = false } for _, pool := range w.worker.Spec.Pools { @@ -135,7 +139,7 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { if err != nil { return err } - machineImages = appendMachineImage(machineImages, apisazure.MachineImage{ + machineImages = appendMachineImage(machineImages, azureapi.MachineImage{ Name: pool.MachineImage.Name, Version: pool.MachineImage.Version, URN: urn, @@ -205,7 +209,7 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { if infrastructureStatus.Networks.VNet.ResourceGroup != nil { networkConfig["vnetResourceGroup"] = *infrastructureStatus.Networks.VNet.ResourceGroup } - if imageSupportAcceleratedNetworking != nil && *imageSupportAcceleratedNetworking && w.isMachineTypeSupportingAcceleratedNetworking(pool.MachineType) { + if imageSupportAcceleratedNetworking != nil && *imageSupportAcceleratedNetworking && w.isMachineTypeSupportingAcceleratedNetworking(pool.MachineType) && acceleratedNetworkAllowed { networkConfig["acceleratedNetworking"] = true } machineClassSpec["network"] = networkConfig diff --git a/pkg/controller/worker/machines_test.go b/pkg/controller/worker/machines_test.go index 213d76698..48c7999c3 100644 --- a/pkg/controller/worker/machines_test.go +++ b/pkg/controller/worker/machines_test.go @@ -344,10 +344,9 @@ var _ = Describe("Machines", func() { "region": region, "resourceGroup": resourceGroupName, "network": map[string]interface{}{ - "vnet": vnetName, - "subnet": subnetName, - "vnetResourceGroup": vnetResourceGroupName, - "acceleratedNetworking": true, + "vnet": vnetName, + "subnet": subnetName, + "vnetResourceGroup": vnetResourceGroupName, }, "availabilitySetID": availabilitySetID, "tags": vmTags, @@ -367,11 +366,6 @@ var _ = Describe("Machines", func() { "urn": machineImageURN, } - defaultMachineClass["network"] = map[string]interface{}{ - "vnet": vnetName, - "subnet": subnetName, - "vnetResourceGroup": vnetResourceGroupName, - } imageIdMachineClass = copyMachineClass(defaultMachineClass) imageIdMachineClass["image"] = map[string]interface{}{ "id": machineImageID,