Skip to content

feat(vm): add IPAM for additional network interfaces#2612

Merged
hardcoretime merged 51 commits into
mainfrom
feat/vm/additional-network-ipam
Jul 15, 2026
Merged

feat(vm): add IPAM for additional network interfaces#2612
hardcoretime merged 51 commits into
mainfrom
feat/vm/additional-network-ipam

Conversation

@hardcoretime

@hardcoretime hardcoretime commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

Add IPAM (IP Address Management) for virtual machine additional network interfaces, integrating with the SDN module's IPAM capabilities (address pools, IPAddress resources, DHCP delivery).

Two allocation modes are supported for additional networks that have an IPAM pool (spec.ipam.ipAddressPoolRef):

  1. Automatic (DHCP): when ipAddressName is not set in .spec.networks[], the VM controller creates an SDN IPAddress (type Auto) bound to the VM via ownerReferences and passes it to SDN. SDN allocates an address from the pool and delivers it to the guest OS via DHCP. The address is stable across VM restarts and migrations (bound to the VM, not the ephemeral pod).

  2. Static: when ipAddressName is set, the controller uses a user-provided IPAddress resource (type Static). The address is determined by the user.

If an additional network does not have an IPAM pool, the feature is not enabled — the interface operates in L2-only mode with manual IP configuration in the guest OS (as before).

The allocated IP address is reflected in status.networks[].ipAddress.

Why do we need it, and what problem does it solve?

Previously, additional network interfaces operated at L2 only — IP addresses had to be configured manually inside the guest OS (e.g., via Cloud-Init). This led to:

  • Address conflicts between manually configured IPs and SDN-allocated addresses on the same interface.
  • No declarative way to request a specific IP for an additional network (unlike Main network via VirtualMachineIPAddress).
  • No IP visibility in VM status for additional interfaces.
  • VMs hanging in Starting when network configuration was invalid — CNI d8-sdn fails hard on missing IPAddress, blocking pod creation.

This PR solves these by having the VM controller manage IPAddress resources for additional networks (analogous to VirtualMachineIPAddress for the Main network), with resilient startup (skip problematic interfaces) and reactive reconciliation (watch IPAddress to provision interfaces when addresses become available).

What is the expected result?

  • A VM with an additional network that has an IPAM pool receives an IP automatically via DHCP (auto mode) or uses a user-specified static IP (ipAddressName).
  • The IP is visible in status.networks[].ipAddress.
  • The IP is stable across VM restarts and live migrations.
  • If an additional network is misconfigured (e.g., ipAddressName references a non-existent IPAddress, or the network has no pool), the VM starts without that interface and reports the error in the NetworkReady condition.
  • Changing ipAddressName (add/remove/switch auto↔static) is applied live without pod recreation or VM restart.
  • Creating an IPAddress after VM start triggers reconciliation via watcher — the interface is attached automatically (hotplug).

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: vm
type: feature
summary: "Add IPAM for additional network interfaces: automatic (DHCP) and static IP allocation via SDN IPAddress resources."

@hardcoretime hardcoretime added this to the v1.10.0 milestone Jul 8, 2026
@hardcoretime
hardcoretime force-pushed the feat/vm/additional-network-ipam branch from 920d0e4 to d5acfb3 Compare July 9, 2026 01:01
@hardcoretime hardcoretime added the e2e/run Run e2e test on cluster of PR author label Jul 9, 2026
@deckhouse-BOaTswain

deckhouse-BOaTswain commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Jul 9, 2026
@hardcoretime
hardcoretime force-pushed the feat/vm/additional-network-ipam branch from d5acfb3 to bc615b4 Compare July 9, 2026 08:13
prismagod
prismagod previously approved these changes Jul 10, 2026
@hardcoretime
hardcoretime force-pushed the feat/vm/additional-network-ipam branch from c5ed5e8 to 6fa53cb Compare July 10, 2026 16:31
Comment thread test/e2e/vm/ipam_additional_networks.go Outdated
Comment thread test/e2e/vm/ipam_additional_networks.go Outdated
Comment thread test/e2e/vm/ipam_additional_networks.go Outdated
Comment thread test/e2e/vm/ipam_additional_networks.go Outdated
Comment thread test/e2e/vm/additional_network_interfaces.go Outdated
Comment thread test/e2e/internal/util/sdn.go Outdated
Comment thread images/virtualization-artifact/pkg/common/network/readiness.go
Comment thread images/virtualization-artifact/pkg/common/network/ipaddress.go Outdated
Comment thread images/virtualization-artifact/pkg/controller/vm/internal/ipaddress_handler.go Outdated
Comment thread images/virtualization-artifact/pkg/controller/vm/internal/network.go Outdated
Comment thread images/virtualization-artifact/pkg/controller/vm/internal/network_ipam_test.go Outdated
hardcoretime and others added 20 commits July 15, 2026 19:02
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
Signed-off-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com>
@hardcoretime
hardcoretime merged commit 5a3d9e8 into main Jul 15, 2026
29 of 32 checks passed
@hardcoretime
hardcoretime deleted the feat/vm/additional-network-ipam branch July 15, 2026 16:29
deckhouse-BOaTswain pushed a commit that referenced this pull request Jul 16, 2026
Add IPAM (IP Address Management) for virtual machine additional network interfaces, integrating with the SDN module's IPAM capabilities (address pools, IPAddress resources, DHCP delivery).

Signed-off-by: Roman Sysoev <roman.sysoev@flant.com>
Co-authored-by: Max Chervov <max.chervov@gmail.com>
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.

6 participants