Skip to content

fix: disable aks node controller and only start at boot and wait for network online target#8911

Closed
awesomenix wants to merge 1 commit into
mainfrom
nishp/anc/dontwaitnetwork
Closed

fix: disable aks node controller and only start at boot and wait for network online target#8911
awesomenix wants to merge 1 commit into
mainfrom
nishp/anc/dontwaitnetwork

Conversation

@awesomenix

Copy link
Copy Markdown
Contributor

dont wait for network-online.target start in parallel, this saves about 4s

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

This PR aims to reduce node boot/provisioning latency by removing the aks-node-controller.service dependency on network-online.target (so the unit can be started earlier/in parallel) and instead waiting for network readiness within the provisioning command script (cse_cmd.sh) and (selectively) in the ANC wrapper when hotfix download paths are used.

Changes:

  • Make aks-node-controller.service a static unit (no [Install] section) and remove After=/Wants= for network-online.target.
  • Add network-online.target wait logic to cse_cmd.sh (and the corresponding ANC template), plus conditional waits in aks-node-controller-wrapper.sh before hotfix network operations.
  • Update VHD build and validation scripts to keep the ANC unit disabled/static and validate the new state.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
vhdbuilder/packer/test/linux-vhd-content-test.sh Updates VHD validation to require ANC unit to be static.
vhdbuilder/packer/pre-install-dependencies.sh Disables ANC service during VHD build to keep it from running before provisioning artifacts exist.
parts/linux/cloud-init/artifacts/cse_cmd.sh Adds an explicit wait for network-online.target before running provisioning.
parts/linux/cloud-init/artifacts/aks-node-controller.service Removes network-online.target ordering and makes the unit static.
parts/linux/cloud-init/artifacts/aks-node-controller-wrapper.sh Adds conditional network-online waits for hotfix-related operations.
aks-node-controller/parser/templates/cse_cmd.sh.gtpl Keeps the generated cse_cmd.sh template in sync with the new network-online wait behavior.

Comment thread parts/linux/cloud-init/artifacts/cse_cmd.sh Outdated
Comment thread aks-node-controller/parser/templates/cse_cmd.sh.gtpl Outdated
Comment thread parts/linux/cloud-init/artifacts/aks-node-controller-wrapper.sh
Comment thread parts/linux/cloud-init/artifacts/aks-node-controller-wrapper.sh Outdated
RemainAfterExit=yes

[Install]
WantedBy=basic.target

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you probably were aware of this too

🔴 High Risk — 🏗️ Architecture / Backward Compatibility
parts/linux/cloud-init/artifacts/aks-node-controller.service removes [Install] and WantedBy, and vhdbuilder/packer/pre-install-dependencies.sh now disables the unit. That drops the long-standing boot fallback path (service auto-start) and makes provisioning depend entirely on boothook start timing.
This aligns with the failing PR E2E signal: multiple scenarios are stuck in provision-wait loop ([ -f /opt/azure/containers/provision.complete ]) and never reach expected CSE output (ADO build 172002687, Run AgentBaker E2E).
Mitigation: restore a fallback start path (or equivalent robust trigger) so ANC still starts when boothook path misses/races.

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.

The problem is that we drop in the cse-cmd.sh or the aks node config only as part of boothook.

So we want to wait for it to be written before we can startup aks node controller otherwise we will have an issue where the service starts up before that and misses the file completely.

In future when we exclusively move to aks node controller we can add an explicity wait for aks node config before service starts that way everything is synchronized.

Copilot AI review requested due to automatic review settings July 14, 2026 01:19
@awesomenix
awesomenix force-pushed the nishp/anc/dontwaitnetwork branch from ff8ad6a to 0a50baa Compare July 14, 2026 01:19

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 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread parts/linux/cloud-init/artifacts/cse_cmd.sh Outdated
Comment thread aks-node-controller/parser/templates/cse_cmd.sh.gtpl Outdated
Comment thread parts/linux/cloud-init/artifacts/aks-node-controller-wrapper.sh
@aks-node-assistant

Copy link
Copy Markdown
Contributor

AgentBaker Linux gate detective

Run: https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=172097539
Failed job/stage/task: e2e / Run AgentBaker E2E / Run AgentBaker E2E, exit code 1.

Detective summary: E2E failed with the recurring broad gotestsum multi-leaf pattern: many ACL/ARM64/FIPS/RCV1P leaves failed, and the task/test-results output is not enough to isolate a single root assertion for the selected failed pair.

Likely cause / signature: $aggSig; this pushed the signature above the recurring threshold, so repair item #38796920 was created.

Confidence: Medium for grouping; PR author should inspect only targeted subgroups if scenario artifacts show a consistent PR-related assertion.

Recommended owner/action: Node Lifecycle E2E owner should inspect scenario artifacts/test-log JSON and split to narrower signatures when concrete assertions recur.

Strongest alternative: PR-specific CSE/RCV1P regression; less likely as the top-level gate signature because this run matches the broad recurring aggregate, but targeted artifact review is warranted.

Evidence: ADO timeline marks E2E task failed; test run 528965996 contains many failed IDs; gotestsum summary starts with broad ACL failures and no single dominant assertion in the available output.

Wiki signature: $aggSig

Copilot AI review requested due to automatic review settings July 15, 2026 14:26

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 9 out of 9 changed files in this pull request and generated 3 comments.

Comment on lines +27 to +36
wait_for_network_online() {
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
echo "network-online.target reached at $(date -Ins)"
else
echo "Timed out waiting for network-online.target at $(date -Ins)" >&2
return 1
fi
}
Comment on lines +77 to +86
wait_for_network_online() {
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
echo "network-online.target reached at $(date -Ins)"
else
echo "Timed out waiting for network-online.target at $(date -Ins)" >&2
return 1
fi
}
Comment on lines +77 to +89
wait_for_network_online() {
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
echo "network-online.target reached at $(date -Ins)"
else
echo "Timed out waiting for network-online.target at $(date -Ins)" >&2
return 1
fi
}

wait_for_network_online || exit 124

@aks-node-assistant

Copy link
Copy Markdown
Contributor

AgentBaker Linux gate detective

Run: https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=172464976
Failed job/stage/task: �2e / Run AgentBaker E2E / Run AgentBaker E2E

Detective summary: The E2E task ended with 17 failed leaves. The visible leaf is Test_ACL_Scriptless/default timing out around scenario setup, with RCV1P/ACL slow-readiness warnings in the same run; this does not isolate to the CSE boot/network-online change.

Likely cause/signature: �2e-gotestsum-multi-leaf-no-error-body — broad E2E session/readiness degradation with insufficient leaf body, rather than a targeted product regression.

Confidence: Medium; the evidence shows aggregate multi-leaf readiness failures, but not a single deterministic leaf root cause.

Recommended owner/action: E2E/platform owners should inspect the run's scenario logs and RCV1P/shared-cluster readiness; if recurring, improve leaf error surfacing and route through the existing repair item.

Strongest alternative: PR #8911's CSE boot sequencing change could affect provisioning timing. Less likely because the failure shape is broad multi-leaf readiness/context-deadline noise, not a stable CSE boot assertion.

Evidence: Timeline log 562, ADO test run 532204889, visible ACL_Scriptless context deadline, RCV1P slow readiness warnings.

Wiki: �2e-gotestsum-multi-leaf-no-error-body

@Devinwong Devinwong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Just the PR title seems conflicting with description.

Copilot AI review requested due to automatic review settings July 16, 2026 23:07
@awesomenix
awesomenix force-pushed the nishp/anc/dontwaitnetwork branch from 26a5835 to d828d22 Compare July 16, 2026 23:07

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@awesomenix awesomenix changed the title fix: start at boot and wait for network online target in cse_cmd.sh fix: disable aks node controller and only start at boot and wait for network online target Jul 16, 2026
Copilot AI review requested due to automatic review settings July 16, 2026 23:25
@awesomenix
awesomenix force-pushed the nishp/anc/dontwaitnetwork branch from d828d22 to fe66bac Compare July 16, 2026 23:25

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings July 17, 2026 03:05
@awesomenix
awesomenix force-pushed the nishp/anc/dontwaitnetwork branch from fe66bac to e06a1e7 Compare July 17, 2026 03:05

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 12 out of 12 changed files in this pull request and generated 5 comments.

Comment on lines +43 to +55
wait_for_network_online() {
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
echo "network-online.target reached at $(date -Ins)"
else
echo "Timed out waiting for network-online.target at $(date -Ins)" >&2
return 1
fi
}

wait_for_network_online || exit 124

Comment on lines +77 to +89
wait_for_network_online() {
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
echo "network-online.target reached at $(date -Ins)"
else
echo "Timed out waiting for network-online.target at $(date -Ins)" >&2
return 1
fi
}

wait_for_network_online || exit 124

Comment on lines +77 to +81
if [ "${ENABLE_PROVISIONING_HOTFIX:-}" = "true" ]; then
wait_for_network_online || return 124
log "ENABLE_PROVISIONING_HOTFIX=true; running check-hotfix to refresh hotfix pointer"
if "$BIN_PATH" check-hotfix; then
log "ANC check-hotfix completed; hotfix pointer refresh attempted"
Comment on lines +87 to +91
if [ -f "$HOTFIX_JSON" ]; then
if jq -e 'has("version")' "$HOTFIX_JSON" >/dev/null 2>&1; then
wait_for_network_online || return 124
fi
log "Found ANC hotfix config at ${HOTFIX_JSON}; running download-hotfix"
Comment thread pkg/agent/baker.go
Comment on lines 71 to 86
flatcarTemplate = `{
"ignition": { "version": "3.4.0" },
"systemd": {
"units": [{
"name": "aks-node-controller.service",
"enabled": true
}]
},
"storage": {
"files": [%s]
"files": [%s],
"links": [{
"path": "/etc/systemd/system/basic.target.wants/aks-node-controller.service",
"target": "/etc/systemd/system/aks-node-controller.service",
"overwrite": true
}]
}
Copilot AI review requested due to automatic review settings July 17, 2026 04:34
@awesomenix
awesomenix force-pushed the nishp/anc/dontwaitnetwork branch from e06a1e7 to 5314760 Compare July 17, 2026 04:34

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 11 out of 11 changed files in this pull request and generated 5 comments.

Comment on lines +27 to +36
wait_for_network_online() {
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
echo "network-online.target reached at $(date -Ins)"
else
echo "Timed out waiting for network-online.target at $(date -Ins)" >&2
return 1
fi
}
Comment on lines +77 to +85
if [ "${ENABLE_PROVISIONING_HOTFIX:-}" = "true" ]; then
wait_for_network_online || return 124
log "ENABLE_PROVISIONING_HOTFIX=true; running check-hotfix to refresh hotfix pointer"
if "$BIN_PATH" check-hotfix; then
log "ANC check-hotfix completed; hotfix pointer refresh attempted"
else
log "ANC check-hotfix failed; continuing (fail-open)"
fi
fi
Comment on lines +88 to +90
if jq -e 'has("version")' "$HOTFIX_JSON" >/dev/null 2>&1; then
wait_for_network_online || return 124
fi
Comment on lines +43 to +52
wait_for_network_online() {
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
echo "network-online.target reached at $(date -Ins)"
else
echo "Timed out waiting for network-online.target at $(date -Ins)" >&2
return 1
fi
}
Comment on lines +77 to +86
wait_for_network_online() {
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
echo "network-online.target reached at $(date -Ins)"
else
echo "Timed out waiting for network-online.target at $(date -Ins)" >&2
return 1
fi
}
Copilot AI review requested due to automatic review settings July 17, 2026 05:55
@awesomenix
awesomenix force-pushed the nishp/anc/dontwaitnetwork branch from 5314760 to d62c318 Compare July 17, 2026 05:55

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 11 out of 11 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

parts/linux/cloud-init/artifacts/aks-node-controller.service:8

  • With the service being enabled at boot (e.g., via Flatcar Ignition), RemainAfterExit=yes can prevent the boothook’s later systemctl start from re-running the oneshot after provisioning files are written, because the unit may already be in an active (exited) state from an earlier no-op run. Removing RemainAfterExit avoids this “started too early once” latch.
Type=oneshot
ExecStart=/opt/azure/containers/aks-node-controller-wrapper.sh
RemainAfterExit=yes

Comment thread pkg/agent/baker.go
Comment on lines +73 to 86
"systemd": {
"units": [{
"name": "aks-node-controller.service",
"enabled": true
}]
},
"storage": {
"files": [%s]
"files": [%s],
"links": [{
"path": "/etc/systemd/system/basic.target.wants/aks-node-controller.service",
"target": "/etc/systemd/system/aks-node-controller.service",
"overwrite": true
}]
}
Comment on lines +44 to +46
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
Comment on lines +78 to +80
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
Comment on lines +28 to +30
echo "Waiting for network-online.target at $(date -Ins)"

if timeout 30 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done'; then
Comment on lines +81 to +83
# The cloud-init boothook starts ANC after writing its provisioning files.
# Keep the unit disabled in the VHD image so it cannot run before those files are ready.
systemctl disable aks-node-controller.service || exit 1

@awesomenix awesomenix left a comment

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.

will hold off on this change, feels a bit high risk

@awesomenix
awesomenix marked this pull request as draft July 17, 2026 13:45
@awesomenix

Copy link
Copy Markdown
Contributor Author

this PR is actually useless because netowrk is always online before boothook

@awesomenix awesomenix closed this Jul 21, 2026
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