Skip to content

Commit a0c5e38

Browse files
authored
fix u2o policy route allocate too many openflows cause oom (#3099)
1 parent a9fdbf9 commit a0c5e38

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

pkg/controller/subnet.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2515,13 +2515,13 @@ func (c *Controller) addPolicyRouteForU2OInterconn(subnet *kubeovnv1.Subnet) err
25152515
U2OexcludeIPAs = u2oExcludeIp6Ag
25162516
}
25172517

2518-
match1 := fmt.Sprintf("%s.dst == %s && %s.dst != $%s", ipSuffix, cidrBlock, ipSuffix, U2OexcludeIPAs)
2518+
match1 := fmt.Sprintf("%s.dst == %s", ipSuffix, cidrBlock)
25192519
match2 := fmt.Sprintf("%s.dst == $%s && %s.src == %s", ipSuffix, U2OexcludeIPAs, ipSuffix, cidrBlock)
25202520
match3 := fmt.Sprintf("%s.src == %s", ipSuffix, cidrBlock)
25212521

25222522
/*
25232523
policy1:
2524-
prio 31000 match: "ip4.dst == underlay subnet cidr && ip4.dst != node ips" action: allow
2524+
prio 29400 match: "ip4.dst == underlay subnet cidr" action: allow
25252525
25262526
policy2:
25272527
prio 31000 match: "ip4.dst == node ips && ip4.src == underlay subnet cidr" action: reroute physical gw
@@ -2536,7 +2536,7 @@ func (c *Controller) addPolicyRouteForU2OInterconn(subnet *kubeovnv1.Subnet) err
25362536
action := ovnnb.LogicalRouterPolicyActionAllow
25372537
if subnet.Spec.Vpc == c.config.ClusterRouter {
25382538
klog.Infof("add u2o interconnection policy for router: %s, match %s, action %s", subnet.Spec.Vpc, match1, action)
2539-
if err := c.ovnClient.AddLogicalRouterPolicy(subnet.Spec.Vpc, util.SubnetRouterPolicyPriority, match1, action, nil, externalIDs); err != nil {
2539+
if err := c.ovnClient.AddLogicalRouterPolicy(subnet.Spec.Vpc, util.U2OSubnetPolicyPriority, match1, action, nil, externalIDs); err != nil {
25402540
klog.Errorf("failed to add u2o interconnection policy1 for subnet %s %v", subnet.Name, err)
25412541
return err
25422542
}

pkg/util/const.go

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ const (
187187
OvnFip = "ovn"
188188
IptablesFip = "iptables"
189189

190+
U2OSubnetPolicyPriority = 29400
190191
GatewayRouterPolicyPriority = 29000
191192
OvnICPolicyPriority = 29500
192193
NodeRouterPolicyPriority = 30000

test/e2e/kube-ovn/underlay/underlay.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ func checkU2OItems(f *framework.Framework, subnet *apiv1.Subnet, underlayPod, ov
785785
asName := strings.Replace(fmt.Sprintf("%s.u2o_exclude_ip.%s", subnet.Name, protocolStr), "-", ".", -1)
786786
if !isU2OCustomVpc {
787787
ginkgo.By(fmt.Sprintf("checking underlay subnet's policy1 route %s", protocolStr))
788-
hitPolicyStr := fmt.Sprintf("%d %s.dst == %s && %s.dst != $%s allow", util.SubnetRouterPolicyPriority, protocolStr, cidr, protocolStr, asName)
788+
hitPolicyStr := fmt.Sprintf("%d %s.dst == %s allow", util.U2OSubnetPolicyPriority, protocolStr, cidr)
789789
checkPolicy(hitPolicyStr, subnet.Spec.U2OInterconnection, subnet.Spec.Vpc)
790790

791791
ginkgo.By(fmt.Sprintf("checking underlay subnet's policy2 route %s", protocolStr))

0 commit comments

Comments
 (0)