Repository navigation
feat(anc): initialize Azure cloud natively in init-cloud for AKSNodeConfig - #10262
Closed
Abigail Liang (abigailliang-aks-sig-node) wants to merge 5 commits into
Closed
Abigail Liang (abigailliang-aks-sig-node) wants to merge 5 commits into
Abigail Liang (abigailliang-aks-sig-node) wants to merge 5 commits into
Conversation
…onfig The VHD launcher runs init-cloud before acquiring an ANC hotfix (#10066), so custom and sovereign clouds can reach RepoDepot. When ANC provisions from AKSNodeConfig alone (no --nbc-cmd, e.g. Phase 3), init-cloud now installs Azure cloud certificates, configures RepoDepot repositories and schedules certificate refresh in Go, in the shell's order, instead of running init-aks-cloud.sh. It then writes the existing empty marker so provisioning skips the shell. Legacy CSE, Phase 1 and NBC provisioning (Phase 2/2.5) keep the shell initializer unchanged. If native initialization fails, no marker is written, the launcher skips hotfix acquisition and provisioning runs init-aks-cloud.sh as before. Re-running initialization after a hotfix that changes it is left to follow-up changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 27252e94-5b2b-4932-9585-70e98b9e21e4
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Mariner removal flattened these tests so the err from os.Stat shadowed the one in the repository loop, which govet shadow reports. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Scriptless nodes on VHDs that include the native cloud initialization run it through aks-node-controller instead of init-aks-cloud.sh. The native path logs different messages and installs the certificate refresh cron entry as refresh-cloud-certificates rather than ca-refresh, so the RCV1P validators, which matched only the shell output, failed even though certificates were installed and refresh was scheduled. Accept either implementation's output for the endpoint mode, opt-in and not-opted-in log checks and for the refresh cron entry. NBC and older VHDs still run init-aks-cloud.sh, so the shell output must keep passing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 27252e94-5b2b-4932-9585-70e98b9e21e4
Reduce verbosity while preserving key behavioral details: - Replace 70+ lines of implementation minutiae with ~12 lines of core concepts - Clarify the two-path design: AKSNodeConfig (Go) vs NBC (shell) - Consolidate certificate, refresh, and repository handling descriptions - Maintain technical accuracy while improving readability
Abigail Liang (abigailliang-aks-sig-node)
requested review from
a team
as code owners
December 4, 2026 23:28
Copilot started reviewing on behalf of
Abigail Liang (abigailliang-aks-sig-node)
December 4, 2026 23:28
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unguarded Unix syscalls prevent ANC from compiling on Windows. Separately, Ubuntu’s default cron PATH prevents the daily trust-bundle refresh; the APT directory check rejects usable repositories that return 403, causing hotfix acquisition to be skipped; and the two-minute timeout kills valid longer-running cache updates, potentially exhausting initialization’s deadline. Successful commands other than dnf also discard stderr, hiding repository-fetch failures and certificate warnings.
7 open issues
Unix process syscalls prevent Windows builds · New Cron PATH omits sbin, preventing certificate refresh · New APT directory-listing check rejects valid repositories · New Two-minute timeout can abort valid cache updates · New Successful command stderr warnings are discarded · New Overlapping test matrices duplicate coverage · New Duplicate repository assertions across integration tests · New
What changed in this PR
Moves AKSNodeConfig cloud initialization into ANC’s native Go implementation while preserving NBC’s shell path.
Changes:
- Adds certificate installation, repository configuration, scheduled refresh, and event logging.
- Separates initialization paths and adds a certificate-refresh command.
- Adds Go tests and updates E2E validation and documentation.
| File | Description |
|---|---|
| e2e/scenario/validators.go | Accepts shell and native initialization output. |
| aks-node-controller/README.md | Documents native initialization and refresh. |
| aks-node-controller/cloud_test_helpers_test.go | Adds shared cloud test fixtures. |
| aks-node-controller/cloud_runtime.go | Adds command, HTTP, and file helpers. |
| aks-node-controller/cloud_runtime_test.go | Tests runtime helpers and cancellation. |
| aks-node-controller/cloud_runtime_events_test.go | Tests operation event logging. |
| aks-node-controller/cloud_repositories.go | Configures Ubuntu and Azure Linux repositories. |
| aks-node-controller/cloud_repositories_test.go | Tests validation and cache retries. |
| aks-node-controller/cloud_repositories_integration_test.go | Tests repository initialization flow. |
| aks-node-controller/cloud_repositories_configuration_test.go | Tests generated repository configuration. |
| aks-node-controller/cloud_refresh.go | Implements certificate-refresh execution. |
| aks-node-controller/cloud_refresh_test.go | Tests refresh arguments and location normalization. |
| aks-node-controller/cloud_refresh_schedule.go | Installs cron jobs and systemd timers. |
| aks-node-controller/cloud_refresh_schedule_test.go | Tests refresh scheduling and failures. |
| aks-node-controller/cloud_init.go | Separates native and NBC initialization. |
| aks-node-controller/cloud_init_test.go | Tests initialization paths and marker behavior. |
| aks-node-controller/cloud_certificates.go | Selects certificate modes and checks opt-in. |
| aks-node-controller/cloud_certificates_test.go | Tests certificate refresh behavior across platforms. |
| aks-node-controller/cloud_certificate_transport.go | Retrieves certificate manifests and payloads. |
| aks-node-controller/cloud_certificate_transport_test.go | Tests retries, truncation, and redirects. |
| aks-node-controller/cloud_certificate_transport_json_test.go | Tests manifest JSON parsing. |
| aks-node-controller/cloud_certificate_transport_behavior_test.go | Tests transport compatibility with shell behavior. |
| aks-node-controller/cloud_certificate_store.go | Installs certificates and logs public PEMs. |
| aks-node-controller/cloud_certificate_store_test.go | Tests Ubuntu bundle symlink handling. |
| aks-node-controller/cloud_certificate_store_behavior_test.go | Tests trust-store installation and diagnostics. |
| aks-node-controller/app.go | Registers refresh command and test hooks. |
Review effort: Max
Comment on lines
+147
to
+149
| cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} | ||
| cmd.Cancel = func() error { | ||
| err := syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) |
| } | ||
| lines = append(lines, line) | ||
| } | ||
| lines = append(lines, "0 19 * * * "+command) |
Comment on lines
+118
to
+121
| microsoftSource := endpoint + "/microsoft/ubuntu/" + platform.Version + "/prod" | ||
| if _, err := c.repositoryGET(ctx, microsoftSource); err != nil { | ||
| return fmt.Errorf("check Ubuntu Microsoft repository: %w", err) | ||
| } |
Comment on lines
+144
to
+145
| ctx, cancel := context.WithTimeout(ctx, cloudCommandTimeout) | ||
| defer cancel() |
Comment on lines
+168
to
+172
| if name == "dnf" { | ||
| // DNF can report unavailable repositories on stderr despite exiting zero. | ||
| _, _ = stdout.Write(stderr.Bytes()) | ||
| } | ||
| return stdout.Bytes(), nil |
| } | ||
| } | ||
|
|
||
| func TestCloudCertificateOptInNonTrueResponsesSkip(t *testing.T) { |
| "github.com/Azure/agentbaker/aks-node-controller/config" | ||
| ) | ||
|
|
||
| func TestCloudUbuntuRepositoryConfiguration(t *testing.T) { |
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.



Summary
AKS Node Controller now initializes Azure cloud natively in Go for AKSNodeConfig (instead of shelling out). NBC paths remain unchanged.
Two-Path Design
`init-cloud` splits based on input:
Both install certificates → configure repos → schedule refresh → write marker.
On failure: No marker → launcher skips hotfix → CSE retries (graceful fallback).
What Changed
Impact
Phase 3 no longer shells out for cloud init. Cleaner separation: AKSNodeConfig in Go, NBC in shell.