Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions api/evpn/v1alpha1/fabric_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions api/evpn/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/samples/v1alpha1_fabric.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ spec:
protocol: IBGP
ibgp:
asNumber: 65000
maximumPaths: 4
routeReflectors:
- name: spine-rrs
deviceSelector:
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/index.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions internal/controller/evpn/fabric_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
10 changes: 9 additions & 1 deletion internal/controller/evpn/fabric_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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),
Expand Down
Loading