feat: windows-exporter into windows vhd build#8516
Conversation
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. |
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 ce25fa5..83b378c 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 620eb5a..0110021 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 d5aea5a..d9c995c 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 7012908..395b4e0 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 41b56d8..2e010f7 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 efdd638..f8ae8fa 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 |
| # carry windowsexporterfunc.ps1 in the CSE script package. | ||
| if (Get-Command -Name Install-WindowsExporter -ErrorAction SilentlyContinue) { | ||
| Logs-To-Event -TaskName "AKS.WindowsCSE.InstallWindowsExporter" -TaskMessage "Install aks-windows-exporter if VHD-baked" | ||
| Install-WindowsExporter |
There was a problem hiding this comment.
I'm confused. Are we installing and configuring windows exporter during VHD Bake time or during Node Provisioning time? This PR seems to do both. But it only does the installation during node provisioning time if the script to install windows exporter is on the VHD already - which means it will have been done during VHD bake time.
There was a problem hiding this comment.
the func being calling "Install-WindowsExporter" might be a bit strong here. During VHD build we add the binarys and config. Then during CSE we use NSSM to create the aks-windows-exporter service(?) and start it and make sure it's healthy. maybe registering/setup would be better than install here
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 #