feat: windows-exporter into windows vhd build#8516
Open
chmill-zz wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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-exporterat CSE time via newwindowsexporterfunc.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. |
Contributor
Changes cached containers or packages on windows VHDsPlease 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.
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 |
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 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 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 #