From 2cc0e1e37233a818379916a309c1e4fc99b0e8f1 Mon Sep 17 00:00:00 2001 From: Sergei Lukianov Date: Fri, 24 Nov 2023 16:37:12 -0800 Subject: [PATCH] [cag] add needed chain link ips For directly attached leaf we only need spine-side and for not directly attached leaf, we're adding leaf-side as that would be source IPs for traffic to control node. --- pkg/ctrl/controlagent/controlagent_ctrl.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/ctrl/controlagent/controlagent_ctrl.go b/pkg/ctrl/controlagent/controlagent_ctrl.go index fe85032e..d7353ac4 100644 --- a/pkg/ctrl/controlagent/controlagent_ctrl.go +++ b/pkg/ctrl/controlagent/controlagent_ctrl.go @@ -182,6 +182,21 @@ func (r *ControlAgentReconciler) buildNetworkd(serverName string, conns *wiringa chainSwitchIPs = append(chainSwitchIPs, sw.Spec.IP) } + for _, conn := range conns.Items { + if conn.Spec.Fabric == nil { + continue + } + + for _, link := range conn.Spec.Fabric.Links { + // if leaf is directly attached, we're adding spine side of the link + if direct[link.Leaf.DeviceName()] { + chainSwitchIPs = append(chainSwitchIPs, link.Spine.IP) + } else { // if leaf is not directly attached, we're adding leaf side of the link + chainSwitchIPs = append(chainSwitchIPs, link.Leaf.IP) + } + } + } + for _, conn := range conns.Items { if conn.Spec.Management == nil { continue @@ -220,7 +235,7 @@ func (r *ControlAgentReconciler) buildNetworkd(serverName string, conns *wiringa } nextHops := []networkdNextHop{} - // Chain link only for non Management ports as mgmt <> front panel doesn't work on real switches + // enable chain link only for non Management ports as mgmt <> front panel doesn't work on real switches if !strings.HasPrefix(swPort, "Management") { for _, ip := range chainSwitchIPs { routes = append(routes, networkdRoute{