Skip to content

Commit

Permalink
delete "allow" policy route on subnet deletion (#1628)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Jun 20, 2022
1 parent 4935fa6 commit bc838d5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,22 @@ func (c *Controller) deletePolicyRouteByGatewayType(subnet *kubeovnv1.Subnet, ga
return nil
}

for _, cidr := range strings.Split(subnet.Spec.CIDRBlock, ",") {
if cidr == "" {
continue
}

af := 4
if util.CheckProtocol(cidr) == kubeovnv1.ProtocolIPv6 {
af = 6
}
match := fmt.Sprintf("ip%d.dst == %s", af, cidr)
if err := c.ovnLegacyClient.DeletePolicyRoute(c.config.ClusterRouter, util.SubnetRouterPolicyPriority, match); err != nil {
klog.Errorf("failed to delete logical router policy for CIDR %s of subnet %s: %v", cidr, subnet.Name, err)
return err
}
}

if gatewayType == kubeovnv1.GWDistributedType {
nodes, err := c.nodesLister.List(labels.Everything())
if err != nil {
Expand Down

0 comments on commit bc838d5

Please sign in to comment.