Skip to content

Realize NetworkAttachments through EVPN Fabrics - #702

Merged
nikatza merged 3 commits into
mainfrom
networkattachment
Nov 10, 2026
Merged

nikatza merged 3 commits into
mainfrom
networkattachment

Conversation

@felix-kaestner

Copy link
Copy Markdown
Collaborator

The EVPN NetworkAttachment controller realizes an overlay NetworkAttachment
through one EVPN Fabric.

Supported topology

A NetworkAttachment must select at least one Interface. Every selected
Interface must:

  • have type Physical or Aggregate;
  • already be a trunk switchport;
  • use Exact allowed-VLAN mode; omission means Exact; and
  • reference a Device that belongs to exactly one Fabric.

All selected Devices must belong to the same Fabric. Stretched attachments
across Fabrics are not supported. Invalid attachments report Ready=False and
retain their last known-good realization until the error is corrected.

Two NetworkAttachments for the same Network may not resolve to overlapping
Device sets. Both attachments report an error when they conflict, and existing
realization is preserved.

VNI and EVPN resources

The first attachment for a Network/Fabric pair creates a shared VNI Claim from
Fabric.spec.vniPool. The Fabric owns the Claim, so the allocation survives
periods with no attachments and is deleted with the Fabric. As an MVP
limitation, deleting the Network can leave the Claim until Fabric deletion.

After allocation, the controller creates one VLAN and one bridged
EVPNInstance per selected Device. The NetworkAttachment owns these resources.
The EVPNInstance uses an automatically generated route distinguisher and an
explicit Route Target derived according to RFC 8365 section 5.1.2.1.
Auto-derivation supports only 2-octet Fabric iBGP ASNs (1..65535).

Existing VLANs or EVPNInstances that are not controlled by the attachment are
reported as conflicts and are never adopted or overwritten.

Interface VLAN membership

Once an attachment requests a VLAN on an Interface, the EVPN controller owns
that Interface/VLAN membership. It preserves unrelated allowed VLANs, retains
the membership while any attachment status still records it, and removes it
when the final demand disappears. This can remove a membership that existed
before the first attachment requested the same VLAN.

NetworkAttachment.status.interfaces records the Device, Kubernetes Interface
resource, and VLAN ID for every realized membership. The controller uses this
inventory to clean up selector changes and deletion. If no explicit allowed
VLANs remain, the field is set to nil, restoring the Interface API default
that allows all VLANs.

@swagner-de swagner-de added the review-scheduled The PR is being reviewed. label Nov 5, 2026
@hardikdr hardikdr added the area/switch-automation Automation processes for network switch management and operations. label Nov 9, 2026
@hardikdr hardikdr added this to Roadmap Nov 9, 2026
IvoGoman
IvoGoman previously approved these changes Nov 10, 2026
Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Resolve selected Physical and Aggregate Exact trunk Interfaces through
Devices to a single Fabric and record the typed forwarding context.
Reject competing attachments requesting the same Device-local VLAN,
including attachments belonging to different Networks.

Allocate a shared Network-scoped VNI Claim owned by the Fabric and
validate its allocation before creating attachment-owned VLANs and
bridged EVPNInstances. Set RD to Auto and explicitly derive import and
export route targets per RFC 8365 using two-octet iBGP AS numbers.
Retain VNI Claims across attachment and Network deletion until their
Fabric is removed.

Persist Interface/VLAN ownership in status before device realization.
Preserve unrelated allowed VLANs, clean stale memberships and owned
resources on selector changes, and remove Interface memberships during
finalization. Garbage collection handles attachment-owned children.

Add indexed dependency watches, switchport VLAN mutation methods,
generated API artifacts, and resource-driven controller tests.

Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Signed-off-by: Pujol <enric.pujol@sap.com>
@github-actions

Copy link
Copy Markdown

Caution

No coverage for base commit 2752ef0 was found, so this report compares against its ancestor 57f9cd7 (1 commit earlier)

Merging this branch changes the coverage (4 decrease, 2 increase)

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/api/core/v1alpha1 3.31% (+0.99%) 👍
github.com/ironcore-dev/network-operator/api/evpn/v1alpha1 0.00% (ø)
github.com/ironcore-dev/network-operator/api/overlay/v1alpha1 0.00% (ø)
github.com/ironcore-dev/network-operator/cmd 0.00% (ø)
github.com/ironcore-dev/network-operator/internal/controller/cisco/nx 65.44% (+0.18%) 👍
github.com/ironcore-dev/network-operator/internal/controller/core 62.41% (-0.11%) 👎
github.com/ironcore-dev/network-operator/internal/controller/evpn 80.65% (-0.62%) 👎
github.com/ironcore-dev/network-operator/internal/controller/overlay 63.89% (-7.02%) 👎
github.com/ironcore-dev/network-operator/internal/controller/pool 74.05% (-1.05%) 👎
Coverage details

Compared to commit 57f9cd7 (run #42849655988)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/api/core/v1alpha1/interface_types.go 56.92% (+53.35%) 65 (+37) 37 (+36) 28 (+1) 🌟
github.com/ironcore-dev/network-operator/api/evpn/v1alpha1/fabric_types.go 0.00% (ø) 5 0 5
github.com/ironcore-dev/network-operator/api/evpn/v1alpha1/groupversion_info.go 0.00% (ø) 2 0 2
github.com/ironcore-dev/network-operator/api/overlay/v1alpha1/networkattachment_types.go 0.00% (ø) 6 (+1) 0 6 (+1)
github.com/ironcore-dev/network-operator/api/overlay/v1alpha1/zz_generated.deepcopy.go 0.00% (ø) 117 (+16) 0 117 (+16)
github.com/ironcore-dev/network-operator/cmd/main.go 0.00% (ø) 337 (+6) 0 337 (+6)
github.com/ironcore-dev/network-operator/internal/controller/evpn/doc.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/internal/controller/evpn/network_controller.go 78.75% (+78.75%) 160 (+160) 126 (+126) 34 (+34) 🌟
github.com/ironcore-dev/network-operator/internal/controller/evpn/networkattachment_controller.go 78.46% (+78.46%) 557 (+557) 437 (+437) 120 (+120) 🌟
github.com/ironcore-dev/network-operator/internal/controller/overlay/doc.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/internal/controller/overlay/network_controller.go 66.67% (-6.06%) 54 (-1) 36 (-4) 18 (+3) 👎
github.com/ironcore-dev/network-operator/internal/controller/overlay/networkattachment_controller.go 61.11% (-7.98%) 54 (-1) 33 (-5) 21 (+4) 👎

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files:

  • github.com/ironcore-dev/network-operator/api/core/v1alpha1/interface_types_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/evpn/network_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/evpn/networkattachment_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/evpn/suite_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/overlay/network_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/overlay/networkattachment_controller_test.go

@nikatza
nikatza merged commit 3e70e99 into main Nov 10, 2026
26 checks passed
@nikatza
nikatza deleted the networkattachment branch November 10, 2026 21:55
@github-project-automation github-project-automation Bot moved this to Done in Roadmap Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/switch-automation Automation processes for network switch management and operations. review-scheduled The PR is being reviewed. size/XXL

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants