Skip to content

feat: build aks-node-controller for windows - #10035

Open
Abdul Asfari (aboodasfari) wants to merge 1 commit into
mainfrom
abdulasfari/anc-windows-build
Open

Abdul Asfari (aboodasfari) wants to merge 1 commit into
mainfrom
abdulasfari/anc-windows-build

Conversation

@aboodasfari

Copy link
Copy Markdown
Member

What this PR does / why we need it:

First step towards running aks-node-controller (ANC) on Windows nodes (Windows scriptless). ANC did not compile for GOOS=windows because goal_state.go used the Linux-only syscall.Flock. This PR makes it build on Windows with no Linux behaviour change. It does not yet make provisioning work on Windows.

  • Move the file lock into filelock_unix.go (unchanged flock) and filelock_windows.go (returns errors.ErrUnsupported; its only caller writes the Linux Hyper-V KVP pool file, and Windows exposes KVP through the registry).
  • Rename const.go to const_unix.go (//go:build !windows) and add const_windows.go with Windows paths under C:\AzureData\aks-node-controller\. This is a separate directory because the legacy Windows CSE already writes C:\AzureData\provision.complete with different contents. The events dir matches $global:EventsLoggingDir in parts/windows/windowscsehelper.ps1.
  • Disable the waagent Ready-report handoff on Windows (empty marker path, plus an early return in reportProvisionStatus).
  • CI: add GOOS=windows go build and go vet for aks-node-controller in go-test.yml.

Validation: build and vet pass for linux, windows and darwin; go test ./... passes (macOS); golangci-lint is clean for linux and windows. Tests were not run on Windows.

Which issue(s) this PR fixes:

ADO task 40462515 (story 39927311, Windows Scriptless)

@aboodasfari
Abdul Asfari (aboodasfari) marked this pull request as ready for review November 10, 2026 02:29
Copilot AI balanced review requested due to automatic review settings November 10, 2026 02:29
@github-actions

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   21 suites   1m 18s ⏱️
789 tests 789 ✅ 0 💤 0 ❌
815 runs  815 ✅ 0 💤 0 ❌

Results for commit d40e57e.

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
test 0% ❌
windows 27% ❌
staging_cse_windows Package 1 71% ➖
debug 0% ❌
provisioningscripts 2% ❌
parts_windows Package 1 73% ➖
Summary 39% (1983 / 7220) ❌

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
shellspec spec 30% ❌
Summary 30% (4912 / 16591) ❌

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.

🟢 Approval recommended

No active review issues are recorded for the Windows compilation changes.

No open issues 🎉

What changed in this PR

Enables aks-node-controller to compile for Windows as a first step toward Windows scriptless provisioning, while preserving Linux behavior. Windows provisioning itself remains out of scope.

Changes:

  • Isolates file locking by platform, retaining Unix flock and returning unsupported on Windows.
  • Adds Windows-specific paths and disables the default Linux waagent Ready-report handoff on Windows.
  • Adds Windows cross-build and go vet checks to CI.
File Description
aks-node-controller/​main.go Uses the platform-specific events directory.
aks-node-controller/​goal_state.go Calls the platform-specific file-lock helper.
aks-node-controller/​filelock_windows.go Returns unsupported for Linux KVP file locking.
aks-node-controller/​filelock_unix.go Preserves the existing exclusive flock behavior.
aks-node-controller/​const_windows.go Defines Windows paths separate from legacy CSE state.
aks-node-controller/​const_unix.go Keeps existing non-Windows paths and adds the events constant.
aks-node-controller/​app.go Skips Ready reporting when no marker path is configured.
.github/​workflows/​go-test.yml Adds Windows build and vet checks for the controller.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
github.com/Azure/agentbaker/aks-node-controller 73% ➖
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 92% ✔
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 35% ❌
github.com/Azure/agentbaker/pkg/agent 79% ➖
github.com/Azure/agentbaker/pkg/agent/datamodel 77% ➖
github.com/Azure/agentbaker/pkg/agent/toggles 0% ❌
github.com/Azure/agentbaker/pkg/vhdbuilder/datamodel 87% ✔
Summary 76% (6096 / 8046) ➖

@@ -1,3 +1,5 @@
//go:build !windows

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 don't like these flags. We won't be able to test linux logic on windows machines. And windows logic on linux.

Should avoid them unless it required for some system calls

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.

Test may fail on some system unexpectedly

@r2k1 Artur Khantimirov (r2k1) Nov 10, 2026 •

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.

There are multiple alternatives. Not sure which one is better.

One example:

type OSConfig struct {...}
var LinuxConfig = OSConfig{...}
var WindowsConfig = OSConfig{...}

go test $(go list ./... | grep -v e2e) -coverprofile=coverage/agentbaker.out -covermode=atomic
(cd aks-node-controller && go build -mod=readonly ./... && go test ./... -coverprofile=../coverage/aks-node-controller.out -covermode=atomic)
# aks-node-controller will also run on Windows nodes; keep it (and its tests) compiling there.
(cd aks-node-controller && GOOS=windows go build -mod=readonly ./... && GOOS=windows go vet ./...)

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 don't think we need to do this.

Eventually we're going to compile it. Don't need to do it twice

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants