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 935fa92 commit 4b56b63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2212,13 +2212,13 @@ 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: reroute physical gw
Expand All @@ -2233,7 +2233,7 @@ func (c *Controller) addPolicyRouteForU2OInterconn(subnet *kubeovnv1.Subnet) err

if subnet.Spec.Vpc == c.config.ClusterRouter {
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 @@ -161,6 +161,7 @@ const (
OvnFip = "ovn"
IptablesFip = "iptables"

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

0 comments on commit 4b56b63

Please sign in to comment.