Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable accelerated network for AvSet clusters #100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/usage-as-end-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
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