Skip to content

kubevirt: Support default route destinations in NoCloud config - #1310

Open
Ar-maan05 wants to merge 1 commit into
coreos:mainfrom
Ar-maan05:kubevirt-nocloud-route-to-default
Open

Ar-maan05 wants to merge 1 commit into
coreos:mainfrom
Ar-maan05:kubevirt-nocloud-route-to-default

Conversation

@Ar-maan05

Copy link
Copy Markdown
Contributor

cloud-init and Netplan accept default as a route destination, and Netplan recommends routes: [{to: default, via: ...}] over the deprecated gateway4/gateway6 keys. The KubeVirt NoCloud parser passed the v2 to and v1 destination fields directly to IpNetwork::from_str(), so user-supplied networkData like this:

version: 2
ethernets:
  eth0:
    addresses: [192.168.1.10/24]
    routes:
      - to: default
        via: 192.168.1.1

made networks() and rd_network_kargs() fail with invalid address: default, rejecting the whole network configuration rather than just the route.

This adds a small parse_route_destination() helper used by both the v1 and v2 paths, which maps default to 0.0.0.0/0 or ::/0 based on the address family of the gateway. That matches cloud-init's own normalization in _normalize_net_keys() (cloudinit/net/network_state.py).

New v1 and v2 fixtures cover both address families; both tests fail on main and pass with this change, and both fixtures pass make validate-fixtures against the upstream cloud-init schemas.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: coreos/afterburn/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9636259f-7cfe-41e0-a025-70b4f36b6f29
📥 Commits

Reviewing files that changed from the base of the PR and between b3c48e0 and f6d106d.

📒 Files selected for processing: 1
  • docs/release-notes.md
🚧 Files skipped from review as they are similar to previous changes: 1
  • docs/release-notes.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 9
  • GitHub Check: Lints, pinned toolchain
  • GitHub Check: Tests (release), stable toolchain
  • GitHub Check: Tests (release), minimum supported toolchain
  • GitHub Check: Tests, unstable toolchain (beta)
  • GitHub Check: Tests, unstable toolchain (nightly)
  • GitHub Check: Build (Fedora)
  • GitHub Check: Check binary size
  • GitHub Check: Tests, stable toolchain
  • GitHub Check: tmt-tests
📝 Walkthrough

KubeVirt NoCloud v1 and v2 route conversion now accepts default as a destination. It resolves to an IPv4 or IPv6 /0 network based on the gateway. Fixtures and tests cover both configuration versions.

Changes: NoCloud default route support

Layer / File(s) Summary
Resolve default route destinations
src/providers/kubevirt/nocloud.rs, docs/release-notes.md
V1 and v2 route conversion use a shared helper to resolve default based on the gateway address family. Route documentation and the release note describe the alias.
Verify v1 and v2 default routes
src/providers/kubevirt/tests.rs, tests/fixtures/kubevirt/route_to_default_nocloud_v1/*, tests/fixtures/kubevirt/route_to_default_nocloud_v2/*
The fixtures configure IPv4 and IPv6 default routes. Tests check the parsed routes and generated kernel arguments.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to f6d10

No merge-blocking concern is established for the release-note change.

Pre-merge checks: Passed 6 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Title check Warning The title clearly describes the KubeVirt NoCloud change and uses the required subsystem prefix, imperative mood, and length. It fails the lowercase-after-colon requirement because it uses "Support". Change the title to "kubevirt: support default route destinations in NoCloud config".
Passed Passed checks: 6 passed
Check name Status Explanation
Description check Passed The description directly explains the parsing failure, the shared helper, the IPv4 and IPv6 behavior, and the added tests and fixtures.
Docstring Coverage Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (1 skipped: 1 u…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Commit Message Convention Passed The PR contains one non-merge commit. Its subject is kubevirt: Support \\default\ route destinations in NoCloud config, which uses a valid subsystem prefix, an imperative description, no trailing p…
Release Notes Passed The PR changes user-visible KubeVirt NoCloud networking behavior, and it updates docs/release-notes.md. The new Upcoming Afterburn 5.12.0 minor-change entry states: “KubeVirt: Support default rout…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Binary size report (target/release/afterburn)

Size
Base (main) 4.7MiB
PR (#1310) 4.7MiB
Delta +512B (0.01%)

@Ar-maan05
Ar-maan05 force-pushed the kubevirt-nocloud-route-to-default branch from e149e46 to b3c48e0 Compare October 13, 2026 18:02
cloud-init and Netplan accept `default` as a route destination, and
Netplan recommends `routes: [{to: default, via: ...}]` over the
deprecated `gateway4` and `gateway6` keys. The NoCloud parser passed
the v2 `to` and v1 `destination` fields straight to
`IpNetwork::from_str()`, so such a config failed with "invalid address:
default" and the whole network configuration was rejected, leaving the
instance without any network kargs.

Map `default` to `0.0.0.0/0` or `::/0` depending on the address family
of the gateway, the same way cloud-init normalizes it.

Signed-off-by: Armaan Sandhu <armaan.sandhu0504@gmail.com>
@Ar-maan05
Ar-maan05 force-pushed the kubevirt-nocloud-route-to-default branch from b3c48e0 to f6d106d Compare October 14, 2026 15:18

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.

1 participant