You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: staging/cse/windows/kubernetesfunc.ps1
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -182,6 +182,7 @@ function Check-APIServerConnectivity {
182
182
)
183
183
Logs-To-Event -TaskName "AKS.WindowsCSE.CheckAPIServerConnectivity"-TaskMessage "Start to check API server connectivity."
184
184
$retryCount=0
185
+
$LastException=$null
185
186
186
187
do {
187
188
$retryString="${retryCount}/${MaxRetryCount}"
@@ -202,16 +203,18 @@ function Check-APIServerConnectivity {
202
203
$tcpClient.Close()
203
204
} catch [System.AggregateException] {
204
205
Write-Log"Retry ${retryString}: Failed to connect to API server $MasterIP. AggregateException: "+$_.Exception.ToString()
206
+
$LastException=$_.Exception.ToString()
205
207
} catch {
206
208
Write-Log"Retry ${retryString}: Failed to connect to API server $MasterIP. Error: $_"
207
-
}
209
+
$LastException=$_.ToString()
210
+
}
208
211
209
212
$retryCount++
210
213
Write-Log"Retry ${retryString}: Sleep $RetryInterval and then retry to connect to API server"
211
214
Sleep $RetryInterval
212
215
} while ($retryCount-lt$MaxRetryCount)
213
216
214
-
Set-ExitCode-ExitCode $global:WINDOWS_CSE_ERROR_CHECK_API_SERVER_CONNECTIVITY-ErrorMessage "Failed to connect to API server $MasterIP after $retryCount retries"
217
+
Set-ExitCode-ExitCode $global:WINDOWS_CSE_ERROR_CHECK_API_SERVER_CONNECTIVITY-ErrorMessage "Failed to connect to API server $MasterIP after $retryCount retries. Last exception: $LastException"
0 commit comments