Skip to content

feat: windows-exporter into windows vhd build - #8516

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

chmill-zz wants to merge 21 commits into
mainfrom
exporterWindows

Conversation

@chmill-zz

@chmill-zz chmill-zz commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bake windows-exporter binaries, configuration, health script, and C:\k\skip_vhd_windows_exporter into the Windows VHD. The baked skip marker disables aks-vm-extension management from the outset: there is no runtime ownership transfer or extension fallback on these VHDs.

CSE registers the baked exporter as a disabled NSSM service in BasePrep (after the kube package provides nssm.exe), so PIS-cached images carry the service without running it. NodePrep enables and starts it, registering it first if BasePrep did not, and uses bounded health retries to tolerate asynchronous SERVICE_START_PENDING responses. Startup failures and exceptions are logged and node provisioning continues. CSE never creates or removes the skip marker.

New VHDs require CSE supporting this startup path. Older VHDs without exporter assets remain extension-managed. VHD tests require the skip marker; E2E independently validates the running service and metrics, so startup failures remain visible in CI.

Port Compatibility

AgentBaker-managed windows-exporter uses port 19100, matching Linux node-exporter, intentionally replacing the extension-managed Windows port 19182. The prior description stated consumers were validated for this migration; production consumer readiness remains a release prerequisite.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 thread vhdbuilder/packer/windows/configure-windows-vhd.ps1
Comment thread vhdbuilder/packer/windows/configure-windows-vhd.ps1 Outdated
Comment thread parts/windows/windowsexporter/windows-exporter-health.ps1 Outdated
Comment thread e2e/validators.go Outdated
Comment thread e2e/validators.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Resolve compatibility gating for older CSE packages and restore the established exporter log paths.

1 open finding
1 resolved since last review

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread parts/windows/kuberneteswindowssetup.ps1.template Outdated
@aks-node-assistant

Copy link
Copy Markdown
Contributor

AgentBaker Linux gate detective

Run: 184683343
Failed job/stage/task: e2e / Run AgentBaker E2E / Run AgentBaker E2E

Detective summary: Run AgentBaker E2E completed 194 scenarios with 2 deterministic failures. First, Ubuntu2404_TemporaryKubeletDisk reached node Ready and passed initial SSH/common validation but timed out waiting for SSH after reboot. Second, RCV1P_Ubuntu2604Minimal failed VMSS creation with ARM OSProvisioningInternalError because cloud-init failed to obtain a DHCP lease on eth0, followed by bastion SSH failures.

Likely cause / signature: e2e-ubuntu2404-temporary-kubelet-disk-reboot-ssh-timeout and e2e-ubuntu2204-vmss-osprovisioning-dhcp-lease-failure. Both look like environment/provisioning flakes rather than a Linux VHD PR regression.

Confidence: Medium-high: build report names only Run AgentBaker E2E as failed; failed test records show two failures; E2E log provides the reboot timeout and ARM DHCP lease error; PR changes are Windows exporter-focused, not Linux provisioning/reboot logic.

Recommended owner/action: Treat as gate flakiness; no PR action unless this PR intentionally affected Linux reboot/provisioning paths. Track recurrences in the wiki and investigate WestUS3 VMSS/DHCP/reboot SSH behavior if frequency increases.

Strongest alternative: PR-caused regression from exporter bake/provisioning changes, but the failures are Linux reboot/DHCP provisioning surfaces outside the Windows exporter change scope and one occurs before scenario validation.

Evidence: build run, build report issues, E2E task log, failed test results run 676998803, and wiki tracker.

Wiki: e2e-ubuntu2404-temporary-kubelet-disk-reboot-ssh-timeout, e2e-ubuntu2204-vmss-osprovisioning-dhcp-lease-failure

"default": {
"versionsV2": [
{
"renovateTag": "<DO_NOT_UPDATE>",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It'd be nice to have a renovate tag to auto upgrade windows exporter - not sure if renovate can do this automatically from packages.aks.azure.com tho.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Chase's AI reviewer: Agreed it'd be nice, but there's no index of the Windows Dalec packages on packages.aks.azure.com for Renovate to watch, so it stays <DO_NOT_UPDATE> like the other Windows packages for now.

Comment thread vhdbuilder/packer/windows/windows-vhd-configuration.ps1 Outdated
Comment thread vhdbuilder/packer/windows/windows-vhd-builder-sig.json Outdated
Comment thread staging/cse/windows/kubernetesfunc.ps1
. "$WINDOWS_SCRIPTS_DIRECTORY\securetlsbootstrapfunc.ps1"
. "$WINDOWS_SCRIPTS_DIRECTORY\windowsciliumnetworkingfunc.ps1"
. "$WINDOWS_SCRIPTS_DIRECTORY\networkisolatedclusterfunc.ps1"
. "$WINDOWS_SCRIPTS_DIRECTORY\windowsexporterfunc.ps1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I really don't like how we have so many of these files now. My preference is to move the windows exporter configuration into one of the others. But there isn't an obvious one 😢

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Chase's AI reviewer: Same feeling, but nothing existing was a natural home, so I kept the exporter logic in its own file. Happy to fold it in if you have a preference.

Comment thread parts/windows/kuberneteswindowssetup.ps1.template Outdated
Comment thread vhdbuilder/packer/windows/configure-windows-vhd.ps1
- Register the aks-windows-exporter service disabled in BasePrep, after
  Get-KubePackage provides nssm.exe, so PIS-cached images carry the service
  without starting it early. NodePrep enables, starts, and health-checks it,
  registering it first if BasePrep did not.
- Move windows-exporter package URL selection into components_json_helpers.ps1
  with unit tests for SKU overrides and single-URL enforcement.
- Move VHD-only exporter config and health assets under
  vhdbuilder/packer/windows/windows-exporter.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved moderate issues affect ownership validation and recovery from partial service registration.

1 open issue
1 resolved since last review

Review effort: Lite

Comment thread staging/cse/windows/windowsexporterfunc.ps1
@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 8b912ca..522aad2 100644
--- a/vhd_files/2022-containerd-gen2.txt
+++ b/vhd_files/2022-containerd-gen2.txt
@@ -25,0 +26 @@ 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
@@ -149,0 +151 @@ Windows 2022-containerd-gen2 package windows scripts default: https://packages.a
+Windows 2022-containerd-gen2 package windows-exporter default: 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 d8c5c57..beee139 100644
--- a/vhd_files/2022-containerd.txt
+++ b/vhd_files/2022-containerd.txt
@@ -25,0 +26 @@ 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
@@ -149,0 +151 @@ Windows 2022-containerd package windows scripts default: https://packages.aks.az
+Windows 2022-containerd package windows-exporter default: 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-tl.txt b/vhd_files/2025-gen2-tl.txt
index 74d381e..bc3ab52 100644
--- a/vhd_files/2025-gen2-tl.txt
+++ b/vhd_files/2025-gen2-tl.txt
@@ -24,0 +25 @@ 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
@@ -85,0 +87 @@ Windows 2025-gen2-tl package windows scripts default: https://packages.aks.azure
+Windows 2025-gen2-tl package windows-exporter default: 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 d3c9d54..61e4767 100644
--- a/vhd_files/2025-gen2.txt
+++ b/vhd_files/2025-gen2.txt
@@ -24,0 +25 @@ 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
@@ -85,0 +87 @@ Windows 2025-gen2 package windows scripts default: https://packages.aks.azure.co
+Windows 2025-gen2 package windows-exporter default: 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 a2f8f75..588027d 100644
--- a/vhd_files/2025.txt
+++ b/vhd_files/2025.txt
@@ -24,0 +25 @@ 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
@@ -85,0 +87 @@ Windows 2025 package windows scripts default: https://packages.aks.azure.com/aks
+Windows 2025 package windows-exporter default: https://packages.aks.azure.com/dalec-packages/windows-exporter/0.31.2/windows/amd64/windows-exporter_0.31.2-1_amd64.zip

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
test 0% ❌
windows 27% ❌
windows/windows-exporter 0% ❌
staging_cse_windows Package 1 67% ➖
debug 0% ❌
provisioningscripts 2% ❌
parts_windows Package 1 73% ➖
Summary 38% (1778 / 7050) ❌

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
github.com/Azure/agentbaker/aks-node-controller 72% ➖
github.com/Azure/agentbaker/aks-node-controller/common 100% ✔
github.com/Azure/agentbaker/aks-node-controller/helpers 68% ➖
github.com/Azure/agentbaker/aks-node-controller/parser 88% ✔
github.com/Azure/agentbaker/aks-node-controller/pkg/gpu 100% ✔
github.com/Azure/agentbaker/aks-node-controller/pkg/nodeconfigutils 88% ✔
github.com/Azure/agentbaker/aks-node-controller/utils 0% ❌
github.com/Azure/agentbaker/apiserver 24% ❌
github.com/Azure/agentbaker/cmd 0% ❌
github.com/Azure/agentbaker/cmd/starter 0% ❌
github.com/Azure/agentbaker/fuzz/api 0% ❌
github.com/Azure/agentbaker/hotfix/render-nodecustomdata 0% ❌
github.com/Azure/agentbaker/pkg/agent 77% ➖
github.com/Azure/agentbaker/pkg/agent/datamodel 78% ➖
github.com/Azure/agentbaker/pkg/agent/toggles 0% ❌
github.com/Azure/agentbaker/pkg/vhdbuilder/datamodel 87% ✔
Summary 74% (5657 / 7592) ➖

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
shellspec spec 28% ❌
Summary 28% (4507 / 15913) ❌

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Address the two unresolved moderate findings in exporter validation and service reconfiguration.

No open issues 🎉

1 resolved since last review

Review effort: Lite

This branch was previously deployed

1 inactive (outdated) deployment
test — b533a022 Deployed May 19, 2026 by chmill-zz via cue #32161
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.

3 participants