Skip to content

Commit

Permalink
diable accelerated network for AvSet clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
vpnachev committed May 28, 2020
1 parent 22f177e commit 2fe5fb4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/usage-as-end-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,5 @@ 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.
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`.
18 changes: 11 additions & 7 deletions pkg/controller/worker/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions pkg/controller/worker/machines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 2fe5fb4

Please sign in to comment.