Skip to content

Commit ee338cb

Browse files
authored
Bug: add fallback when attempting to find network adaptor (#7133)
1 parent 4a618b4 commit ee338cb

29 files changed

Lines changed: 1816 additions & 663 deletions

File tree

.pipelines/.vsts-vhd-builder-pr-windows.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ stages:
7171
useOverrides: False
7272
enableBackfillCleanup: True
7373
buildVmSize: Standard_D16ds_v5
74+
# 2019 only supports gen1, so build that for PRs
7475
build2019containerd: True
75-
build2022containerd: False
76-
build2022containerdgen2: True
77-
build23H2: False
78-
build23H2gen2: True
76+
# 2022 gen1 is the default, so build that for PRs
77+
build2022containerd: True
78+
build2022containerdgen2: False
79+
# 23H2 gen1 is the default, so build that for PRs
80+
build23H2: True
81+
build23H2gen2: False
82+
# 2025 gen2 is the default, so build that for PRs
7983
build2025: False
8084
build2025gen2: True
8185
- stage: delete_old_windows_vhds
@@ -89,4 +93,4 @@ stages:
8993
enabled: true
9094
displayName: Old Windows VHD Cleanup
9195
env:
92-
PROD_SUBSCRIPTION_ID: $(AZURE_PROD_SUBSCRIPTION_ID)
96+
PROD_SUBSCRIPTION_ID: $(AZURE_PROD_SUBSCRIPTION_ID)

e2e/kube.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,22 @@ func (k *Kubeclient) WaitUntilNodeReady(ctx context.Context, t testing.TB, vmssN
160160
continue
161161
}
162162

163-
castNode := event.Object.(*corev1.Node)
164-
if !strings.HasPrefix(castNode.Name, vmssName) {
163+
var nodeFromEvent *corev1.Node
164+
switch v := event.Object.(type) {
165+
case *corev1.Node:
166+
nodeFromEvent = v
167+
168+
default:
169+
t.Logf("skipping object type %T", event.Object)
170+
continue
171+
}
172+
173+
if !strings.HasPrefix(nodeFromEvent.Name, vmssName) {
165174
continue
166175
}
167176

168177
// found the right node. Use it!
169-
node = castNode
178+
node = nodeFromEvent
170179
nodeTaints, _ := json.Marshal(node.Spec.Taints)
171180
nodeConditions, _ := json.Marshal(node.Status.Conditions)
172181

parts/windows/windowscsehelper.ps1

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ $global:WINDOWS_CSE_ERROR_DOWNLOAD_SECURE_TLS_BOOTSTRAP_CLIENT=70 # exit code fo
7777
$global:WINDOWS_CSE_ERROR_INSTALL_SECURE_TLS_BOOTSTRAP_CLIENT=71 # exit code for installing secure TLS bootstrap client failure
7878
$global:WINDOWS_CSE_ERROR_WINDOWS_CILIUM_NETWORKING_INSTALL_FAILED=72
7979
$global:WINDOWS_CSE_ERROR_EXTRACT_ZIP=73
80+
$global:WINDOWS_CSE_ERROR_LOAD_METADATA=74
81+
$global:WINDOWS_CSE_ERROR_PARSE_METADATA=75
8082
# WINDOWS_CSE_ERROR_MAX_CODE is only used in unit tests to verify whether new error code name is added in $global:ErrorCodeNames
8183
# Please use the current value of WINDOWS_CSE_ERROR_MAX_CODE as the value of the new error code and increment it by 1
82-
$global:WINDOWS_CSE_ERROR_MAX_CODE=74
84+
$global:WINDOWS_CSE_ERROR_MAX_CODE=76
8385

8486
# Please add new error code for downloading new packages in RP code too
8587
$global:ErrorCodeNames = @(
@@ -156,7 +158,9 @@ $global:ErrorCodeNames = @(
156158
"WINDOWS_CSE_ERROR_DOWNLOAD_SECURE_TLS_BOOTSTRAP_CLIENT",
157159
"WINDOWS_CSE_ERROR_INSTALL_SECURE_TLS_BOOTSTRAP_CLIENT",
158160
"WINDOWS_CSE_ERROR_WINDOWS_CILIUM_NETWORKING_INSTALL_FAILED",
159-
"WINDOWS_CSE_ERROR_EXTRACT_ZIP"
161+
"WINDOWS_CSE_ERROR_EXTRACT_ZIP",
162+
"WINDOWS_CSE_ERROR_LOAD_METADATA",
163+
"WINDOWS_CSE_ERROR_PARSE_METADATA"
160164
)
161165

162166
# The package domain to be used
@@ -195,7 +199,7 @@ filter Timestamp { "$(Get-Date -Format o): $_" }
195199

196200
function Write-Log($message) {
197201
$msg = $message | Timestamp
198-
Write-Output $msg
202+
Write-Host $msg
199203
}
200204

201205
function DownloadFileOverHttp {
@@ -241,7 +245,7 @@ function DownloadFileOverHttp {
241245
$downloadTimer = [System.Diagnostics.Stopwatch]::StartNew()
242246
try {
243247
$args = @{Uri=$MappedUrl; Method="Get"; OutFile=$DestinationPath; ErrorAction="Stop"}
244-
Retry-Command -Command "Invoke-RestMethod" -Args $args -Retries 5 -RetryDelaySeconds 10
248+
Retry-Command -Command "Invoke-RestMethod" -Args $args -Retries 5 -RetryDelaySeconds 10
245249
} catch {
246250
Set-ExitCode -ExitCode $ExitCode -ErrorMessage "Failed in downloading $MappedUrl. Error: $_"
247251
}
@@ -257,7 +261,7 @@ function DownloadFileOverHttp {
257261
}
258262

259263
$ProgressPreference = $oldProgressPreference
260-
264+
261265
Write-Log "Downloaded file $MappedUrl to $DestinationPath in $elapsedMs ms"
262266
Get-Item $DestinationPath -ErrorAction Continue | Format-List | Out-String | Write-Log
263267
}
@@ -451,10 +455,10 @@ function Install-Containerd-Based-On-Kubernetes-Version {
451455

452456
# Get the current Windows version, this is interim since we are progressively supporting containerd 2.0 for all Windows version. for now only test2025
453457
$windowsVersion = Get-WindowsVersion
454-
Write-Log "Install Containerd with ContainerdURL: $ContainerdUrl, KubernetesVersion: $KubernetesVersion, WindowsVersion: $windowsVersion"
458+
Write-Log "Install Containerd with ContainerdURL: $ContainerdUrl, KubernetesVersion: $KubernetesVersion, WindowsVersion: $windowsVersion"
455459
Logs-To-Event -TaskName "AKS.WindowsCSE.InstallContainerdBasedOnKubernetesVersion" -TaskMessage "Start to install ContainerD based on kubernetes version. ContainerdUrl: $global:ContainerdUrl, KubernetesVersion: $global:KubeBinariesVersion, Windows Version: $windowsVersion"
456460

457-
# $global:ContainerdUrl is set from RP ContainerService.properties.orchestratorProfile.KubernetesConfig.WindowsContainerdURL
461+
# $global:ContainerdUrl is set from RP ContainerService.properties.orchestratorProfile.KubernetesConfig.WindowsContainerdURL
458462
# it can be
459463
# - a full URL. e.g., "https://packages.aks.azure.com/containerd/windows/v0.0.46/binaries/containerd-v0.0.46-windows-amd64.tar.gz"
460464
# - an endpoint: e.g., "https://packages.aks.azure.com/containerd/windows/"
@@ -465,14 +469,14 @@ function Install-Containerd-Based-On-Kubernetes-Version {
465469

466470
$containerdVersion=$global:StableContainerdVersion
467471
Write-Log "Install Containerd with request URL : $ContainerdUrl, Kubernetes version: $KubernetesVersion, Windows version: $windowsVersion."
468-
472+
469473
if ($ContainerdUrl.EndsWith("/")) {
470474
# for now we only preview containerd 2.0 for Windows 2025
471475
if ($windowsVersion -eq $global:WindowsVersion2025) {
472476
$containerdVersion=$global:LatestContainerd2Version
473477
} elseif (([version]$KubernetesVersion).CompareTo([version]$global:MinimalKubernetesVersionWithLatestContainerd) -ge 0) {
474478
$containerdVersion=$global:LatestContainerdVersion
475-
}
479+
}
476480
$containerdPackage = [string]::Format($global:ContainerdPackageTemplate, $containerdVersion)
477481
$ContainerdUrl = $ContainerdUrl + $containerdPackage
478482
} elseif ( $windowsVersion -eq $global:WindowsVersion2025) {
@@ -482,9 +486,9 @@ function Install-Containerd-Based-On-Kubernetes-Version {
482486
$matchedPath = $matches[0]
483487
$containerd2Package = [string]::Format($global:ContainerdPackageTemplate, $global:LatestContainerd2Version)
484488
$ContainerdUrl = $ContainerdUrl.Replace($matchedPath, $containerd2Package)
485-
}
489+
}
486490
}
487-
491+
488492
Write-Log "Install Containerd with resolved containerd pacakge url: $ContainerdUrl, Kubernetes version: $KubernetesVersion, Windows version: $windowsVersion."
489493
Logs-To-Event -TaskName "AKS.WindowsCSE.InstallContainerd" -TaskMessage "Start to install ContainerD. ContainerdUrl: $ContainerdUrl"
490494
Install-Containerd -ContainerdUrl $ContainerdUrl -CNIBinDir $CNIBinDir -CNIConfDir $CNIConfDir -KubeDir $KubeDir
@@ -631,4 +635,4 @@ function Resolve-Error ($ErrorRecord=$Error[0])
631635
{ "$i" * 80
632636
$Exception |Format-List * -Force
633637
}
634-
}
638+
}

pkg/agent/testdata/AKSWindows2019+CustomCloud+ootcredentialprovider/CustomData

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pkg/agent/testdata/AKSWindows2019+CustomCloud/CustomData

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pkg/agent/testdata/AKSWindows2019+CustomVnet/CustomData

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pkg/agent/testdata/AKSWindows2019+EnablePrivateClusterHostsConfigAgent/CustomData

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pkg/agent/testdata/AKSWindows2019+K8S116/CustomData

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pkg/agent/testdata/AKSWindows2019+K8S117/CustomData

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pkg/agent/testdata/AKSWindows2019+K8S118/CustomData

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)