Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

fix: enable Accelerated Networking settings and pick up the right adapter in windows azure function #4585

Merged
merged 11 commits into from
Oct 7, 2021
2 changes: 1 addition & 1 deletion docs/topics/clusterdefinitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ A cluster can have 0 to 12 agent pool profiles. Agent Pool Profiles are used for
| osType | no | Specifies the agent pool's Operating System. Supported values are `Windows` and `Linux`. Defaults to `Linux` |
| distro | no | Specifies the agent pool's Linux distribution. Currently supported values are: `ubuntu-18.04`, `aks-ubuntu-18.04`, `ubuntu-18.04-gen2` (Ubuntu 18.04-LTS running on a [Generation 2 VM](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/generation-2)), and `flatcar` (Flatcar support is currently experimental - [Example of Flatcar Master with Flatcar Agents](../../examples/flatcar/kubernetes-flatcar.json)). For Azure Public Cloud, Azure US Government Cloud, and Azure China Cloud, defaults to `aks-ubuntu-18.04`. For Sovereign Clouds, the default is `ubuntu-18.04`. `aks-ubuntu-18.04` is a custom image based on `ubuntu-18.04` that comes with pre-installed software necessary for Kubernetes deployments. Note: the `ubuntu` and `aks-ubuntu-16.04` distro values may be used if you have a reason to use the EOL (End of Life) Ubuntu 16.04-LTS OS; we do not recommend using Ubuntu 16.04-LTS, as the OS will no longer be receiving security and other critical patches as of April 30, 2021. |
| acceleratedNetworkingEnabled | no | Use [Azure Accelerated Networking](https://azure.microsoft.com/en-us/blog/maximize-your-vm-s-performance-with-accelerated-networking-now-generally-available-for-both-windows-and-linux/) feature for Linux agents (You must select a VM SKU that supports Accelerated Networking). Defaults to `true` if the VM SKU selected supports Accelerated Networking |
| acceleratedNetworkingEnabledWindows | no | Currently unstable, and disabled for new clusters! |
| acceleratedNetworkingEnabledWindows | no | Use [Azure Accelerated Networking](https://azure.microsoft.com/en-us/blog/maximize-your-vm-s-performance-with-accelerated-networking-now-generally-available-for-both-windows-and-linux/) feature for Windows agents (You must select a VM SKU that supports Accelerated Networking). Defaults to `false`. Setting it to `true` requires the base Windows vm images contains the right drivers to support accelerated networking. |
| vmssOverProvisioningEnabled | no | Use [Overprovisioning](https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-design-overview#overprovisioning) with VMSS. This configuration is only valid on an agent pool with an `"availabilityProfile"` value of `"VirtualMachineScaleSets"`. Defaults to `false` |
| enableVMSSNodePublicIP | no | Enable creation of public IP on VMSS nodes (must use `"availabilityProfile": "VirtualMachineScaleSets"`). This configuration is only valid on a cluster running a "Basic" LoadBalancer SKU (`"loadBalancerSku": "Basic"`, see: [`kubernetesConfig`](#kubernetesConfig)). Defaults to `false` |
| LoadBalancerBackendAddressPoolIDs | no | Enables automatic placement of the agent pool nodes into existing load balancer's backend address pools. Each element value of this string array is the corresponding load balancer backend address pool's Azure Resource Manager(ARM) resource ID. By default this property is not included in the API model, which is equivalent to an empty string array. |
Expand Down
31 changes: 26 additions & 5 deletions parts/k8s/windowsazurecnifunc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,36 @@ function New-ExternalHnsNetwork

Write-Log "Creating new HNS network `"ext`""
$externalNetwork = "ext"
$na = @(Get-NetAdapter -Physical)
$nas = @(Get-NetAdapter -Physical)

if ($na.Count -eq 0) {
if ($nas.Count -eq 0) {
throw "Failed to find any physical network adapters"
}

# If there is more than one adapter, use the first adapter.
$managementIP = (Get-NetIPAddress -ifIndex $na[0].ifIndex -AddressFamily IPv4).IPAddress
$adapterName = $na[0].Name
# If there is more than one adapter, use the first adapter that is assigned an ipaddress.
foreach($na in $nas)
{
$netIP = Get-NetIPAddress -ifIndex $na.ifIndex -AddressFamily IPv4 -ErrorAction SilentlyContinue -ErrorVariable netIPErr
if ($netIP)
{
$managementIP = $netIP.IPAddress
$adapterName = $na.Name
break
}
else {
Write-Log "No IPv4 found on the network adapter $($na.Name); trying the next adapter ..."
jadarsie marked this conversation as resolved.
Show resolved Hide resolved
if ($netIPErr) {
Write-Log "error when retrieving IPAddress: $netIPErr"
$netIPErr.Clear()
}
}
}

if(-Not $managementIP)
{
throw "None of the physical network adapters has an IP address"
}

Write-Log "Using adapter $adapterName with IP address $managementIP"
$mgmtIPAfterNetworkCreate

Expand Down
2 changes: 0 additions & 2 deletions pkg/api/vlabs/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,6 @@ func (a *Properties) validateAgentPoolProfiles(isUpdate bool) error {
if to.Bool(agentPoolProfile.AcceleratedNetworkingEnabled) || to.Bool(agentPoolProfile.AcceleratedNetworkingEnabledWindows) {
if a.IsAzureStackCloud() {
return errors.Errorf("AcceleratedNetworkingEnabled or AcceleratedNetworkingEnabledWindows shouldn't be set to true as feature is not yet supported on Azure Stack")
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
} else if to.Bool(agentPoolProfile.AcceleratedNetworkingEnabledWindows) {
return errors.Errorf("Accelerated Networking is currently unstable for Windows + Kubernetes, please set acceleratedNetworkingEnabledWindows to false")
} else if e := validatePoolAcceleratedNetworking(agentPoolProfile.VMSize); e != nil {
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved
return e
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/vlabs/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4908,7 +4908,7 @@ func TestValidateAcceleratedNetworkingEnabledWindows(t *testing.T) {
},
},
},
expectedErr: errors.New("Accelerated Networking is currently unstable for Windows + Kubernetes, please set acceleratedNetworkingEnabledWindows to false"),
expectedErr: nil,
},
}

Expand Down
31 changes: 26 additions & 5 deletions pkg/engine/templates_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.