Skip to content

fix: start at boot and wait for network online target in cse_cmd.sh#8911

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

fix: start at boot and wait for network online target in cse_cmd.sh#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
Comment thread aks-node-controller/parser/templates/cse_cmd.sh.gtpl
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.

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.

exit ${cloudInitExitCode};
fi;
{{end}}
timeout 60 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done' || exit 124
@@ -1,4 +1,5 @@
echo $(date),$(hostname) > ${PROVISION_OUTPUT};
timeout 60 sh -c 'until systemctl is-active --quiet network-online.target; do sleep 0.1; done' || exit 124
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
}
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