Skip to content

Commit

Permalink
fix: ipv6 policy route
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Jul 3, 2020
1 parent e083c48 commit ca12202
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/controller/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ func (c *Controller) handleAddNode(key string) error {
}

match := fmt.Sprintf("ip4.src==$%s && ip4.dst!=$%s", nodeLocalAddressSet, util.SubnetAddressSet)
if util.CheckProtocol(ip) == kubeovnv1.ProtocolIPv6 {
match = fmt.Sprintf("ip6.src==$%s && ip6.dst!=$%s", nodeLocalAddressSet, util.SubnetAddressSet)
}
if err := c.ovnClient.CreatePolicyRoute(c.config.ClusterRouter, match, ip, util.DistributedGatewayPolicyRoutePriority); err != nil {
klog.Errorf("failed to create policy route for node %s, %v", key, err)
return err
Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@ func (c *Controller) reconcileGateway(subnet *kubeovnv1.Subnet) error {
}

match := fmt.Sprintf("ip4.src==%s && ip4.dst!=$%s", subnet.Spec.CIDRBlock, util.SubnetAddressSet)
if subnet.Spec.Protocol == kubeovnv1.ProtocolIPv6 {
match = fmt.Sprintf("ip6.src==$%s && ip6.dst!=$%s", subnet.Spec.CIDRBlock, util.SubnetAddressSet)
}
if err := c.ovnClient.CreatePolicyRoute(c.config.ClusterRouter, match, nodeTunlIPAddr.String(), util.CentralGatewayPolicyRoutePriority); err != nil {
klog.Errorf("failed to create policy route for subnet %s, %v", subnet.Name, err)
return err
Expand Down

0 comments on commit ca12202

Please sign in to comment.