diff --git a/docs/topics/clusterdefinitions.md b/docs/topics/clusterdefinitions.md index b1a7c18c3a..3a70487206 100644 --- a/docs/topics/clusterdefinitions.md +++ b/docs/topics/clusterdefinitions.md @@ -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. | diff --git a/parts/k8s/windowsazurecnifunc.ps1 b/parts/k8s/windowsazurecnifunc.ps1 index 3c2cc564a8..2136133385 100644 --- a/parts/k8s/windowsazurecnifunc.ps1 +++ b/parts/k8s/windowsazurecnifunc.ps1 @@ -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 ..." + 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 diff --git a/pkg/api/vlabs/validate.go b/pkg/api/vlabs/validate.go index 17d3a8f8fd..5538ee939b 100644 --- a/pkg/api/vlabs/validate.go +++ b/pkg/api/vlabs/validate.go @@ -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") - } 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 { return e } diff --git a/pkg/api/vlabs/validate_test.go b/pkg/api/vlabs/validate_test.go index 753429082e..09855c5df9 100644 --- a/pkg/api/vlabs/validate_test.go +++ b/pkg/api/vlabs/validate_test.go @@ -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, }, } diff --git a/pkg/engine/templates_generated.go b/pkg/engine/templates_generated.go index a55dbcf1ef..5d44bcbf7e 100644 --- a/pkg/engine/templates_generated.go +++ b/pkg/engine/templates_generated.go @@ -18852,15 +18852,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 ..." + 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