Skip to content

feat: windows-exporter into windows vhd build#8516

Open
chmill-zz wants to merge 4 commits into
mainfrom
exporterWindows
Open

feat: windows-exporter into windows vhd build#8516
chmill-zz wants to merge 4 commits into
mainfrom
exporterWindows

Conversation

@chmill-zz
Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

this is adding node-exporter into the vhdbuild by default for windows. At boot CSE will register the service in nssm

Which issue(s) this PR fixes:

Fixes #

Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds windows-exporter to the Windows VHD build so nodes can start the aks-windows-exporter service during CSE using VHD-baked assets (with a sentinel to keep aks-vm-extension in no-op mode for these VHDs).

Changes:

  • Bake windows-exporter binaries/config/health script into the Windows VHD and create a sentinel file.
  • Register/start aks-windows-exporter at CSE time via new windowsexporterfunc.ps1, with unit tests and VHD content tests.
  • Add e2e validation ensuring the service is running and serving metrics when the sentinel is present.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
vhdbuilder/packer/windows/windows-vhd-builder-sig.json Stages windows-exporter config + health script into c:\k\ during image build.
vhdbuilder/packer/windows/configure-windows-vhd.ps1 Extracts/stages windows-exporter into C:\k\windows-exporter and creates sentinel.
vhdbuilder/packer/test/windows-vhd-content-test.ps1 Validates windows-exporter assets + sentinel exist on the built VHD.
staging/cse/windows/windowsexporterfunc.ps1 New CSE-time installer to register/start aks-windows-exporter via NSSM and health-check it.
staging/cse/windows/windowsexporterfunc.tests.ps1 Adds Pester tests for sentinel/no-op behavior and error code on missing NSSM.
parts/windows/kuberneteswindowssetup.ps1 Dot-sources exporter functions and invokes Install-WindowsExporter during BasePrep.
parts/windows/windowscsehelper.ps1 Adds a new Windows CSE error code for windows-exporter start failure.
staging/cse/windows/kubernetesfunc.ps1 Adds Defender exclusions for windows-exporter log file paths.
parts/windows/windowsexporter/windows-exporter-config.yml New baked config (port 19182, enabled collectors, service include filter, debug logging).
parts/windows/windowsexporter/windows-exporter-health.ps1 New baked health/version helper used by CSE health validation.
parts/common/components.json Adds windows-exporter component download metadata for VHD caching.
e2e/validators.go Adds Windows exporter validator (service + metrics) gated by sentinel presence.
e2e/scenario_win_test.go Runs the new validator across Windows e2e scenarios.
e2e/config/config.go Fixes a formatting issue in panic error rendering (%w -> %v).
staging/cse/windows/README Updates the list of scripts to download, including windowsexporterfunc.ps1.

Comment thread e2e/validators.go Outdated
Comment thread parts/windows/windowsexporter/windows-exporter-config.yml
Comment thread staging/cse/windows/windowsexporterfunc.ps1
Comment thread parts/common/components.json
@github-actions github-actions Bot added the components This pull request updates cached components on Linux or Windows VHDs label May 13, 2026
@chmill-zz chmill-zz changed the title feat: node-exporter into windows vhd build feat: windows-exporter into windows vhd build May 14, 2026
Copilot AI review requested due to automatic review settings May 14, 2026 19:01
@github-actions
Copy link
Copy Markdown
Contributor

Changes cached containers or packages on windows VHDs

Please get a Windows SIG member to approve.

The following dif file shows any additions or deletions from what will be cached on windows VHDs organised by VHD type.

  • Additions are new things cached.
  • Deletions are things no longer cached.
diff --git a/vhd_files/2022-containerd-gen2.txt b/vhd_files/2022-containerd-gen2.txt
index 7b0f611..b95181d 100644
--- a/vhd_files/2022-containerd-gen2.txt
+++ b/vhd_files/2022-containerd-gen2.txt
@@ -33,0 +34 @@ c:\akse-cache\win-vnet-cni\: https://packages.aks.azure.com/azure-cni/v1.6.21/bi
+c:\akse-cache\windows-exporter\: https://packages.aks.azure.com/dalec-packages/windows-exporter/0.31.2/windows/amd64/windows-exporter_0.31.2-1_amd64.zip
diff --git a/vhd_files/2022-containerd.txt b/vhd_files/2022-containerd.txt
index 8d3d00c..7b0e8b2 100644
--- a/vhd_files/2022-containerd.txt
+++ b/vhd_files/2022-containerd.txt
@@ -33,0 +34 @@ c:\akse-cache\win-vnet-cni\: https://packages.aks.azure.com/azure-cni/v1.6.21/bi
+c:\akse-cache\windows-exporter\: https://packages.aks.azure.com/dalec-packages/windows-exporter/0.31.2/windows/amd64/windows-exporter_0.31.2-1_amd64.zip
diff --git a/vhd_files/2025-gen2.txt b/vhd_files/2025-gen2.txt
index 9e61267..c00e448 100644
--- a/vhd_files/2025-gen2.txt
+++ b/vhd_files/2025-gen2.txt
@@ -31,0 +32 @@ c:\akse-cache\win-vnet-cni\: https://packages.aks.azure.com/azure-cni/v1.6.21/bi
+c:\akse-cache\windows-exporter\: https://packages.aks.azure.com/dalec-packages/windows-exporter/0.31.2/windows/amd64/windows-exporter_0.31.2-1_amd64.zip
diff --git a/vhd_files/2025.txt b/vhd_files/2025.txt
index 1222b2f..8e55803 100644
--- a/vhd_files/2025.txt
+++ b/vhd_files/2025.txt
@@ -31,0 +32 @@ c:\akse-cache\win-vnet-cni\: https://packages.aks.azure.com/azure-cni/v1.6.21/bi
+c:\akse-cache\windows-exporter\: https://packages.aks.azure.com/dalec-packages/windows-exporter/0.31.2/windows/amd64/windows-exporter_0.31.2-1_amd64.zip
diff --git a/vhd_files/23H2-gen2.txt b/vhd_files/23H2-gen2.txt
index d4b7d21..e8eb31a 100644
--- a/vhd_files/23H2-gen2.txt
+++ b/vhd_files/23H2-gen2.txt
@@ -32,0 +33 @@ c:\akse-cache\win-vnet-cni\: https://packages.aks.azure.com/azure-cni/v1.6.21/bi
+c:\akse-cache\windows-exporter\: https://packages.aks.azure.com/dalec-packages/windows-exporter/0.31.2/windows/amd64/windows-exporter_0.31.2-1_amd64.zip
diff --git a/vhd_files/23H2.txt b/vhd_files/23H2.txt
index 03acb98..ed28cd9 100644
--- a/vhd_files/23H2.txt
+++ b/vhd_files/23H2.txt
@@ -32,0 +33 @@ c:\akse-cache\win-vnet-cni\: https://packages.aks.azure.com/azure-cni/v1.6.21/bi
+c:\akse-cache\windows-exporter\: https://packages.aks.azure.com/dalec-packages/windows-exporter/0.31.2/windows/amd64/windows-exporter_0.31.2-1_amd64.zip

Copy link
Copy Markdown
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 15 out of 15 changed files in this pull request and generated 6 comments.

Comment on lines +763 to +764
function Install-WindowsExporterOnVHD
{
}

$exporterZip = Get-ChildItem -Path $exporterCacheDir -Filter "windows-exporter_*_amd64.zip" -File |
Sort-Object -Property Name -Descending |
service:
include: "aks-windows-exporter|kubelet|kubeproxy|containerd|hns|csi-proxy"
log:
level: debug
Comment on lines +25 to +31
if ($null -ne $result -and $result.Contains("version")) {
# {"version":"v0.25.1","revision":"f70fa009de541dc99ed210aa7e67c9550133ef02","branch":"HEAD","buildUser":"cloudtest@781d70d7c000002","buildDate":"20240223-08:06:57","goVersion":"go1.21.3"}
$version = $result -replace ".*""version"":""([^""]+)"".*", '$1'
return $version
} else {
return ""
}
Comment thread e2e/validators.go
Comment on lines +854 to +858
" Write-Output \"metrics endpoint returned status $($resp.StatusCode) with $($resp.Content.Length) bytes\"",
" Write-Output ('metrics validation failures: ' + ($failureReasons -join '; '))",
" Write-Output '--- begin /metrics response ---'",
" Write-Output $resp.Content",
" Write-Output '--- end /metrics response ---'",
Comment thread e2e/validators.go
Comment on lines +831 to +835
res := execScriptOnVMForScenario(ctx, s, strings.Join(sentinelCheck, "\n"))
if strings.Contains(res.stdout, "SKIP") {
s.T.Logf("Skipping aks-windows-exporter validation: sentinel %s not found (aks-vm-extension manages the service on this VHD)", sentinel)
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

components This pull request updates cached components on Linux or Windows VHDs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants