Order nspawn after required host systemd services - #281
Merged
Conversation
Add explicit udev-settle ordering for the Flex agent and nspawn machine, and allow operators to configure required host services that must complete before nspawn starts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Patrick W. Healy (phealy)
had a problem deploying
to
e2e-testing
August 19, 2026 16:40 — with
GitHub Actions
Failure
hbc (bcho)
approved these changes
Aug 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances AKS Flex Node’s host-boot ordering guarantees by adding explicit systemd dependency wiring so the agent and each systemd-nspawn machine can be started after udev settle and optionally after/with additional host services that must finish device setup before the containerized node starts.
Changes:
- Add a daemon task to render a per-machine systemd-nspawn drop-in with
After=and (optionally)Requires=dependencies, and reload systemd. - Introduce
bootstrap.additionalRequiredServicesconfig with validation for safe.serviceunit names, plus tests. - Update the agent’s systemd unit to order after
systemd-udev-settle.service, plus docs and lifecycle assertions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/daemon/systemd_dependencies.go | New task that writes the nspawn dependency drop-in and reloads systemd. |
| pkg/daemon/systemd_dependencies_test.go | Tests drop-in rendering behavior and repeated application. |
| pkg/daemon/start.go | Wires the new dependency task into the node start sequence. |
| pkg/daemon/lifecycle_test.go | Asserts the agent unit orders after systemd-udev-settle.service. |
| pkg/daemon/assets/aks-flex-node-agent.service | Updates agent unit ordering to include systemd-udev-settle.service. |
| pkg/config/config.go | Adds bootstrap.additionalRequiredServices and validates unit-name format. |
| pkg/config/config_test.go | Adds coverage for config load + validation of required services. |
| docs/usages/configuration.md | Documents the new configuration field and its purpose. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Patrick W. Healy (phealy)
had a problem deploying
to
e2e-testing
August 19, 2026 16:48 — with
GitHub Actions
Failure
Pull systemd-udev-settle into the transaction for both the Flex agent and nspawn unit so their After ordering is effective. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Patrick W. Healy (phealy)
had a problem deploying
to
e2e-testing
August 19, 2026 16:50 — with
GitHub Actions
Failure
hbc (bcho)
approved these changes
Aug 19, 2026
Patrick W. Healy (phealy)
temporarily deployed
to
e2e-testing
August 19, 2026 17:35 — with
GitHub Actions
Inactive
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
systemd-udev-settle.servicebootstrap.additionalRequiredServicesfor host services that must complete before nspawn startsRequires=andAfter=dependencies.serviceunit names and document the new settingMotivation
Some host images run services such as
ib_rdma_configure.servicethat rename or otherwise reconfigure devices during boot. If nspawn starts concurrently, it can capture stale device names and fail to expose the expected objects to the worker node. Explicit ordering ensures host device discovery and renaming finish before the machine starts.Configuration
{ "bootstrap": { "additionalRequiredServices": [ "ib_rdma_configure.service" ] } }The generated nspawn drop-in requires each configured service and orders nspawn after it. The dependency configuration is reconciled during bootstrap and repave and remains safe to apply repeatedly.
Validation
make check