Skip to content

Commit

Permalink
OVN Globalnet: Fix missing default route in table 150
Browse files Browse the repository at this point in the history
To support hostNetworking use-case the route-agent handler
programs default route in table 150 with nexthop matching
the nexthop on the ovn-k8s-mp0 interface. Basically, we
want the Submariner managed traffic to be forwarded to the
ovn_cluster_router and pass through the CNI network so that
it reaches the active gateway node in the cluster via the
submariner pipeline.

Fixes: #1982
Signed-off-by: Sridhar Gaddam <[email protected]>
  • Loading branch information
sridhargaddam authored and tpantelis committed Sep 1, 2022
1 parent a0f90b9 commit 7bf874d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions pkg/routeagent_driver/handlers/ovn/host_networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,16 @@ func (ovn *Handler) getNextHopOnK8sMgmtIntf() (*net.IP, error) {
continue
}

for _, subnet := range ovn.localEndpoint.Spec.Subnets {
// To support hostNetworking use-case the route-agent handler programs default route in table 150
// with nexthop matching the nexthop on the ovn-k8s-mp0 interface. Basically, we want the Submariner
// managed traffic to be forwarded to the ovn_cluster_router and pass through the CNI network so that
// it reaches the active gateway node in the cluster via the submariner pipeline.
for _, subnet := range ovn.config.ClusterCidr {
if currentRouteList[i].Dst.String() == subnet {
return &currentRouteList[i].Gw, nil
}
}
}

return nil, fmt.Errorf("could not find the route to %v via %q", ovn.localEndpoint.Spec.Subnets, OVNK8sMgmntIntfName)
return nil, fmt.Errorf("could not find the route to %v via %q", ovn.config.ClusterCidr, OVNK8sMgmntIntfName)
}
4 changes: 2 additions & 2 deletions pkg/routeagent_driver/handlers/ovn/south_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import (

// handleSubnets builds ip rules, and passes them to the specified netlink function
// for provided subnet list
func (ovn *Handler) handleSubnets(subnets []string, ruleFunc func(rule *netlink.Rule) error,
func (ovn *Handler) handleSubnets(remoteSubnets []string, ruleFunc func(rule *netlink.Rule) error,
ignoredErrorFunc func(error) bool,
) error {
for _, subnetToHandle := range subnets {
for _, subnetToHandle := range remoteSubnets {
for _, localSubnet := range ovn.localEndpoint.Spec.Subnets {
rule, err := ovn.getRuleSpec(localSubnet, subnetToHandle, constants.RouteAgentInterClusterNetworkTableID)
if err != nil {
Expand Down

0 comments on commit 7bf874d

Please sign in to comment.