Skip to content

Commit

Permalink
fix u2o policy route generate too many flow tables cause oom
Browse files Browse the repository at this point in the history
  • Loading branch information
changluyi committed Aug 4, 2023
1 parent ca4b6c3 commit 7dcfd17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1856,16 +1856,16 @@ func (c *Controller) addPolicyRouteForU2OInterconn(subnet *kubeovnv1.Subnet) err
U2OexcludeIPAs = u2oExcludeIp6Ag
}

match1 := fmt.Sprintf("%s.dst == %s && %s.dst != $%s", ipSuffix, cidrBlock, ipSuffix, U2OexcludeIPAs)
match1 := fmt.Sprintf("%s.dst == %s", ipSuffix, cidrBlock)
match2 := fmt.Sprintf("%s.dst == $%s && %s.src == %s", ipSuffix, U2OexcludeIPAs, ipSuffix, cidrBlock)
match3 := fmt.Sprintf("%s.src == %s", ipSuffix, cidrBlock)

/*
policy1:
prio 31000 match: "ip4.dst == underlay subnet cidr && ip4.dst != node ips" action: allow
prio 29400 match: "ip4.dst == underlay subnet cidr" action: allow
policy2:
prio 31000 match: "ip4.dst == node ips && ip4.src == underlay subnet cidr" action: reoute physical gw
prio 31000 match: "ip4.dst == node ips && ip4.src == underlay subnet cidr" action: reroute physical gw
policy3:
prio 29000 match: "ip4.src == underlay subnet cidr" action: reroute physical gw
Expand All @@ -1875,7 +1875,7 @@ func (c *Controller) addPolicyRouteForU2OInterconn(subnet *kubeovnv1.Subnet) err
policy3: underlay pod first access u2o interconnection lrp and then reoute to physical gw
*/
klog.Infof("add u2o interconnection policy for router: %s, match %s, action %s", subnet.Spec.Vpc, match1, "allow")
if err := c.ovnLegacyClient.AddPolicyRoute(subnet.Spec.Vpc, util.SubnetRouterPolicyPriority, match1, "allow", "", externalIDs); err != nil {
if err := c.ovnLegacyClient.AddPolicyRoute(subnet.Spec.Vpc, util.U2OSubnetPolicyPriority, match1, "allow", "", externalIDs); err != nil {
klog.Errorf("failed to add u2o interconnection policy1 for subnet %s %v", subnet.Name, err)
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/util/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const (
EcmpRouteType = "ecmp"
NormalRouteType = "normal"

U2OSubnetPolicyPriority = 29400
GatewayRouterPolicyPriority = 29000
NodeRouterPolicyPriority = 30000
SubnetRouterPolicyPriority = 31000
Expand Down

0 comments on commit 7dcfd17

Please sign in to comment.