Skip to content

Conversation

@timmy-wright
Copy link
Contributor

What this PR does / why we need it:

Better error message when API server can't be contacted

Which issue(s) this PR fixes:

Fixes #

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Linux VHD/provisioning artifacts, SIG image version pinning, and CI pipelines (including E2E auth) alongside regenerating snapshot testdata.

Changes:

  • Freeze MarinerV2/AzureLinuxV2 SIG image version and update related tests/testdata.
  • Add disk queue tuning script/service and corresponding E2E validations.
  • Switch CI tasks to AzureCLI@2 and update E2E auth to use Azure CLI credentials.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pkg/agent/testdata/AKSUbuntu2204+CustomCloud/CustomData Regenerated snapshot CustomData payloads.
pkg/agent/testdata/AKSUbuntu2204+China/CustomData Regenerated snapshot CustomData payloads.
pkg/agent/datamodel/sig_config_test.go Update expected SIG version constant for frozen V2 images.
pkg/agent/datamodel/sig_config.go Introduce frozen V2 SIG image version constant and apply it to templates.
pkg/agent/datamodel/osimageconfig.go Adjust cloud-to-image mapping (new cloud entry + key fixes).
pkg/agent/datamodel/linux_sig_version.json Bump linux SIG version value to 202512.06.0.
parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh Remove NVIDIA repo cleanup call from GPU cleanup path.
parts/linux/cloud-init/artifacts/ubuntu/cse_helpers_ubuntu.sh Add apt-get clean after successful installs.
parts/linux/cloud-init/artifacts/mariner/cse_install_mariner.sh Remove NVIDIA repo cleanup call from GPU cleanup path.
parts/linux/cloud-init/artifacts/disk_queue.sh Add disk queue tuning script selecting Azure root/os device link.
parts/linux/cloud-init/artifacts/disk_queue.service Update ExecStart to run the new disk_queue.sh script.
parts/linux/cloud-init/artifacts/cse_config.sh Remove NVIDIA repo cleanup after GPU driver installation.
parts/common/components.json Update multiple component versions and one download location path.
packer.mk Remove az-login logic; target now only sets subscription.
e2e/validators.go Add validators for aks-log-collector and disk_queue.service.
e2e/validation.go Call new validators from common Linux validation suite.
e2e/scenario_test.go Change secure TLS bootstrapping failure setup to use invalid user-assigned identity.
e2e/config/azure.go Switch to Azure CLI credential for ARM clients.
.pipelines/templates/e2e-template.yaml Run E2E scripts via AzureCLI@2 task.
.pipelines/templates/.builder-release-template.yaml Wrap builder steps with AzureCLI@2.
.pipelines/templates/.builder-release-template-windows.yaml Wrap Windows builder steps with AzureCLI@2 and tweak conditions.
.pipelines/templates/.build-and-test-windows-vhds-template.yaml Run cleanup via AzureCLI@2.
.pipelines/scripts/windows_build_vhd.sh Remove explicit make ... az-login invocation.
.pipelines/scripts/windows-sub-cleanup.sh Remove explicit make ... az-login invocation.
.pipelines/scripts/e2e_run.sh Remove managed identity login step; rely on Azure CLI session.
.pipelines/.vsts-vhd-builder-release.yaml Disable MarinerV2/AzureLinuxV2 builds by default.
.pipelines/.vsts-vhd-builder-pr-windows.yaml Run windows sub cleanup via AzureCLI@2.
.pipelines/.vsts-garabge-collection.yaml Run GC script via AzureCLI@2.
.github/workflows/pr-lint.yaml Trigger PR lint workflow on synchronize events.

Copilot AI review requested due to automatic review settings February 9, 2026 03:48
@timmy-wright timmy-wright changed the title Timmy/better error fix: better error message in windows CSE when API server can't be contacted Feb 9, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment on lines +217 to +221
$lastExceptionMessage = ""
if ($LastException -ne $null) {
if ($LastException.Exception -ne $null -and -not [string]::IsNullOrEmpty($LastException.Exception.Message)) {
$lastExceptionMessage = $LastException.Exception.Message
} else {
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$LastException is assigned string values earlier ($_.Exception.ToString() / "$_"), but here it's treated like an exception object ($LastException.Exception.Message). As a result, the .Exception.Message branch will never be used and you may lose useful exception details. Store the exception object consistently (e.g., $_.Exception) and then derive the final single-line message from its .Message/.ToString().

Copilot uses AI. Check for mistakes.
$lastExceptionMessage = $lastExceptionMessage -replace "(`r|`n)+", " "
}

Set-ExitCode -ExitCode $global:WINDOWS_CSE_ERROR_CHECK_API_SERVER_CONNECTIVITY -ErrorMessage "Failed to connect to API server $MasterIP after $retryCount retries. Last exception: $lastExceptionMessage"
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $LastException is never set (e.g., failures that don't throw), the final error message will still include Last exception: with an empty value, which makes the message noisier. Consider only appending the "Last exception" suffix when $lastExceptionMessage is non-empty.

Suggested change
Set-ExitCode -ExitCode $global:WINDOWS_CSE_ERROR_CHECK_API_SERVER_CONNECTIVITY -ErrorMessage "Failed to connect to API server $MasterIP after $retryCount retries. Last exception: $lastExceptionMessage"
$baseErrorMessage = "Failed to connect to API server $MasterIP after $retryCount retries."
$errorMessage = $baseErrorMessage
if (-not [string]::IsNullOrEmpty($lastExceptionMessage)) {
$errorMessage = "$baseErrorMessage Last exception: $lastExceptionMessage"
}
Set-ExitCode -ExitCode $global:WINDOWS_CSE_ERROR_CHECK_API_SERVER_CONNECTIVITY -ErrorMessage $errorMessage

Copilot uses AI. Check for mistakes.
$tcpClient.Close()
} catch [System.AggregateException] {
Write-Log "Retry ${retryString}: Failed to connect to API server $MasterIP. AggregateException: " + $_.Exception.ToString()
Logs-To-Event -TaskName "AKS.WindowsCSE.CheckAPIServerConnectivity" -TaskMessage "Retry ${retryString}: Failed to connect to API server $MasterIP. AggregateException: " + $_.Exception.ToString()
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logs-To-Event -TaskMessage "..." + $_.Exception.ToString() is likely to be parsed in argument mode as multiple arguments ("...", '+', and the exception string), which can break parameter binding at runtime. Wrap the concatenation in parentheses or use a single interpolated string/subexpression so -TaskMessage receives one string value.

Suggested change
Logs-To-Event -TaskName "AKS.WindowsCSE.CheckAPIServerConnectivity" -TaskMessage "Retry ${retryString}: Failed to connect to API server $MasterIP. AggregateException: " + $_.Exception.ToString()
Logs-To-Event -TaskName "AKS.WindowsCSE.CheckAPIServerConnectivity" -TaskMessage "Retry ${retryString}: Failed to connect to API server $MasterIP. AggregateException: $($_.Exception.ToString())"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants