Skip to content

Commit

Permalink
[cag] add needed chain link ips
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Frostman committed Nov 25, 2023
1 parent 5f53e12 commit 2cc0e1e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/ctrl/controlagent/controlagent_ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 2cc0e1e

Please sign in to comment.