Skip to content

Commit b766517

Browse files
authored
fix(windows): decrease retry timeout for network adapter read in windows provisioning scripts (#7480)
1 parent 60f0602 commit b766517

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

staging/cse/windows/azurecnifunc.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,15 +687,15 @@ function Get-AKS-NetworkAdaptor {
687687

688688
# we need the default gateway interface to create the external network
689689
try {
690-
$netIP = Invoke-WithRetry -Command { Get-NetIPAddress -AddressFamily IPv4 -ErrorAction Stop -IpAddress $ipv4Address } -TaskName "AKS.WindowsCSE.NewExternalHnsNetwork" -MaxRetries 5 -DelaySeconds 60
690+
$netIP = Invoke-WithRetry -Command { Get-NetIPAddress -AddressFamily IPv4 -ErrorAction Stop -IpAddress $ipv4Address } -TaskName "AKS.WindowsCSE.NewExternalHnsNetwork" -MaxRetries 300 -DelaySeconds 1
691691
}
692692
catch {
693693
Logs-To-Event -TaskName "AKS.WindowsCSE.NewExternalHnsNetwork" -TaskMessage "Failed to find IP address info for ip address ${ipv4Address}: $($_.Exception.Message). Reverting to old way to configure network"
694694
return Get-NetworkAdaptor-Fallback
695695
}
696696

697697
try {
698-
$na = Invoke-WithRetry -Command { Get-NetAdapter -IncludeHidden -ifindex $netIP.ifIndex -ErrorAction stop } -TaskName "AKS.WindowsCSE.NewExternalHnsNetwork" -MaxRetries 5 -DelaySeconds 60
698+
$na = Invoke-WithRetry -Command { Get-NetAdapter -IncludeHidden -ifindex $netIP.ifIndex -ErrorAction stop } -TaskName "AKS.WindowsCSE.NewExternalHnsNetwork" -MaxRetries 300 -DelaySeconds 1
699699
if (!$na) {
700700
Logs-To-Event -TaskName "AKS.WindowsCSE.NewExternalHnsNetwork" -TaskMessage "Failed to find network adapter info for ip address index $($netIP.ifIndex) and ip address $ipv4Address. Reverting to old way to configure network"
701701
return Get-NetworkAdaptor-Fallback

staging/cse/windows/azurecnifunc.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ Describe 'Get-AKS-NetworkAdaptor' {
17601760
Get-AKS-NetworkAdaptor | Should -Be $mockFallbackAdapter
17611761

17621762
Assert-MockCalled -CommandName "Get-Node-Ipv4-Address" -Exactly -Times 1
1763-
Assert-MockCalled -CommandName "Get-NetIPAddress" -Exactly -Times 5
1763+
Assert-MockCalled -CommandName "Get-NetIPAddress" -Exactly -Times 300
17641764
# Should not reach these calls due to exception
17651765
Assert-MockCalled -CommandName "Get-NetAdapter" -Exactly -Times 0
17661766
Assert-MockCalled -CommandName "Get-NetworkAdaptor-Fallback" -Exactly -Times 1
@@ -1790,7 +1790,7 @@ Describe 'Get-AKS-NetworkAdaptor' {
17901790
$nas | Should -Be $mockFallback
17911791
Assert-MockCalled -CommandName "Get-Node-Ipv4-Address" -Exactly -Times 1
17921792
Assert-MockCalled -CommandName "Get-NetIPAddress" -Exactly -Times 1
1793-
Assert-MockCalled -CommandName "Get-NetAdapter" -Exactly -Times 5
1793+
Assert-MockCalled -CommandName "Get-NetAdapter" -Exactly -Times 300
17941794
Assert-MockCalled -CommandName "Get-NetworkAdaptor-Fallback" -Exactly -Times 1
17951795
}
17961796

0 commit comments

Comments
 (0)