From a90c3ea80c7bd6ebe1dbdf4df499bb618c7a1e81 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Tue, 3 Nov 2026 12:29:52 +0100 Subject: [PATCH] Support iBGP EVPN multipath in Fabric overlay Add an optional maximumPaths field to FabricIBGPSpec that sets the maximum number of equal-cost iBGP paths for the L2VPN EVPN address family on every device in the fabric. The Fabric controller propagates it into the generated per-device BGP resource's EVPN multipath configuration (maps to "maximum-paths ibgp " on Cisco NX-OS). When omitted, the platform default (single best path) applies. Signed-off-by: Sebastian Wagner --- api/evpn/v1alpha1/fabric_types.go | 8 ++++++++ api/evpn/v1alpha1/zz_generated.deepcopy.go | 5 +++++ .../fabrics.evpn.networking.metal.ironcore.dev.yaml | 8 ++++++++ .../evpn.networking.metal.ironcore.dev_fabrics.yaml | 8 ++++++++ config/samples/v1alpha1_fabric.yaml | 1 + docs/api-reference/index.md | 1 + internal/controller/evpn/fabric_controller.go | 13 ++++++++++--- internal/controller/evpn/fabric_controller_test.go | 10 +++++++++- 8 files changed, 50 insertions(+), 4 deletions(-) diff --git a/api/evpn/v1alpha1/fabric_types.go b/api/evpn/v1alpha1/fabric_types.go index 1e0812426..d75f514b1 100644 --- a/api/evpn/v1alpha1/fabric_types.go +++ b/api/evpn/v1alpha1/fabric_types.go @@ -141,6 +141,14 @@ type FabricIBGPSpec struct { // +listMapKey=name // +kubebuilder:validation:MinItems=1 RouteReflectors []RouteReflectorGroup `json:"routeReflectors"` + + // maximumPaths sets the maximum number of equal-cost iBGP paths used for + // L2VPN EVPN multipath load balancing on every device in the fabric. When + // omitted, the platform default (single best path) applies. + // +optional + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Maximum=64 + MaximumPaths *int8 `json:"maximumPaths,omitempty"` } // RouteReflectorGroup defines a set of BGP route reflectors and their clients. diff --git a/api/evpn/v1alpha1/zz_generated.deepcopy.go b/api/evpn/v1alpha1/zz_generated.deepcopy.go index 3465ddcec..0deb364ea 100644 --- a/api/evpn/v1alpha1/zz_generated.deepcopy.go +++ b/api/evpn/v1alpha1/zz_generated.deepcopy.go @@ -110,6 +110,11 @@ func (in *FabricIBGPSpec) DeepCopyInto(out *FabricIBGPSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.MaximumPaths != nil { + in, out := &in.MaximumPaths, &out.MaximumPaths + *out = new(int8) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FabricIBGPSpec. diff --git a/charts/network-operator/templates/crd/fabrics.evpn.networking.metal.ironcore.dev.yaml b/charts/network-operator/templates/crd/fabrics.evpn.networking.metal.ironcore.dev.yaml index 212c04a45..002aac801 100644 --- a/charts/network-operator/templates/crd/fabrics.evpn.networking.metal.ironcore.dev.yaml +++ b/charts/network-operator/templates/crd/fabrics.evpn.networking.metal.ironcore.dev.yaml @@ -307,6 +307,14 @@ spec: iBGP fabric. Supports both plain format (1-4294967295) and dotted notation (1-65535.0-65535) as per RFC 5396. x-kubernetes-int-or-string: true + maximumPaths: + description: |- + maximumPaths sets the maximum number of equal-cost iBGP paths used for + L2VPN EVPN multipath load balancing on every device in the fabric. When + omitted, the platform default (single best path) applies. + maximum: 64 + minimum: 1 + type: integer routeReflectors: description: |- routeReflectors lists the route reflector groups that provide iBGP scalability. diff --git a/config/crd/bases/evpn.networking.metal.ironcore.dev_fabrics.yaml b/config/crd/bases/evpn.networking.metal.ironcore.dev_fabrics.yaml index ae9903b58..818fe598a 100644 --- a/config/crd/bases/evpn.networking.metal.ironcore.dev_fabrics.yaml +++ b/config/crd/bases/evpn.networking.metal.ironcore.dev_fabrics.yaml @@ -304,6 +304,14 @@ spec: iBGP fabric. Supports both plain format (1-4294967295) and dotted notation (1-65535.0-65535) as per RFC 5396. x-kubernetes-int-or-string: true + maximumPaths: + description: |- + maximumPaths sets the maximum number of equal-cost iBGP paths used for + L2VPN EVPN multipath load balancing on every device in the fabric. When + omitted, the platform default (single best path) applies. + maximum: 64 + minimum: 1 + type: integer routeReflectors: description: |- routeReflectors lists the route reflector groups that provide iBGP scalability. diff --git a/config/samples/v1alpha1_fabric.yaml b/config/samples/v1alpha1_fabric.yaml index 00e17f66d..f0e2a97e8 100644 --- a/config/samples/v1alpha1_fabric.yaml +++ b/config/samples/v1alpha1_fabric.yaml @@ -29,6 +29,7 @@ spec: protocol: IBGP ibgp: asNumber: 65000 + maximumPaths: 4 routeReflectors: - name: spine-rrs deviceSelector: diff --git a/docs/api-reference/index.md b/docs/api-reference/index.md index c735245e9..182a895e9 100644 --- a/docs/api-reference/index.md +++ b/docs/api-reference/index.md @@ -124,6 +124,7 @@ _Appears in:_ | --- | --- | --- | --- | | `asNumber` _[IntOrString](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#intorstring-intstr-util)_ | asNumber is the BGP autonomous system number shared by all devices in the
iBGP fabric. Supports both plain format (1-4294967295) and dotted notation
(1-65535.0-65535) as per RFC 5396. | | Required: \{\}
| | `routeReflectors` _[RouteReflectorGroup](#routereflectorgroup) array_ | routeReflectors lists the route reflector groups that provide iBGP scalability.
Each group designates a set of reflectors and their client devices. | | MinItems: 1
Required: \{\}
| +| `maximumPaths` _integer_ | maximumPaths sets the maximum number of equal-cost iBGP paths used for
L2VPN EVPN multipath load balancing on every device in the fabric. When
omitted, the platform default (single best path) applies. | | Maximum: 64
Minimum: 1
Optional: \{\}
| #### FabricLoopbacksSpec diff --git a/internal/controller/evpn/fabric_controller.go b/internal/controller/evpn/fabric_controller.go index e5cca9015..c3a27cc27 100644 --- a/internal/controller/evpn/fabric_controller.go +++ b/internal/controller/evpn/fabric_controller.go @@ -1010,10 +1010,17 @@ func (r *FabricReconciler) reconcileBGP(ctx context.Context, device *v1alpha1.De bgp.Spec.RouterID = routerID // "retain route-target all" is an eBGP-only construct; iBGP route // reflectors reflect all EVPN routes regardless of imported RTs. - bgp.Spec.AddressFamilies = &v1alpha1.BGPAddressFamilies{ - L2vpnEvpn: &v1alpha1.BGPL2vpnEvpn{ + l2vpnEvpn := &v1alpha1.BGPL2vpnEvpn{ + Enabled: true, + } + if mp := fabric.Spec.Overlay.IBGP.MaximumPaths; mp != nil { + l2vpnEvpn.Multipath = &v1alpha1.BGPMultipath{ Enabled: true, - }, + Ibgp: &v1alpha1.BGPMultipathIbgp{MaximumPaths: *mp}, + } + } + bgp.Spec.AddressFamilies = &v1alpha1.BGPAddressFamilies{ + L2vpnEvpn: l2vpnEvpn, } return controllerutil.SetOwnerReference(fabric, bgp, r.Scheme) }) diff --git a/internal/controller/evpn/fabric_controller_test.go b/internal/controller/evpn/fabric_controller_test.go index c9a720f15..7ec4b228d 100644 --- a/internal/controller/evpn/fabric_controller_test.go +++ b/internal/controller/evpn/fabric_controller_test.go @@ -11,6 +11,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" @@ -184,7 +185,8 @@ var _ = Describe("Fabric Controller", func() { Overlay: evpnv1alpha1.FabricOverlaySpec{ Protocol: evpnv1alpha1.OverlayProtocolIBGP, IBGP: &evpnv1alpha1.FabricIBGPSpec{ - ASNumber: intstr.FromInt(65000), + ASNumber: intstr.FromInt(65000), + MaximumPaths: ptr.To[int8](4), RouteReflectors: []evpnv1alpha1.RouteReflectorGroup{ { Name: "spines", @@ -403,6 +405,12 @@ var _ = Describe("Fabric Controller", func() { g.Expect(bgp.Spec.AddressFamilies.L2vpnEvpn.Enabled).To(BeTrue()) g.Expect(bgp.Spec.AddressFamilies.L2vpnEvpn.RouteTargetPolicy).To(BeNil()) + // iBGP EVPN multipath must reflect the fabric maximumPaths. + g.Expect(bgp.Spec.AddressFamilies.L2vpnEvpn.Multipath).NotTo(BeNil()) + g.Expect(bgp.Spec.AddressFamilies.L2vpnEvpn.Multipath.Enabled).To(BeTrue()) + g.Expect(bgp.Spec.AddressFamilies.L2vpnEvpn.Multipath.Ibgp).NotTo(BeNil()) + g.Expect(bgp.Spec.AddressFamilies.L2vpnEvpn.Multipath.Ibgp.MaximumPaths).To(Equal(int8(4))) + g.Expect(bgp.OwnerReferences).To(ContainElement(SatisfyAll( HaveField("Kind", "Fabric"), HaveField("Name", fabric.Name),