Skip to content

Commit

Permalink
fix: delete static route should consider dualstack (#2130)
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Dec 6, 2022
1 parent 9b38bf7 commit 27d22b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ func (c *Controller) handleUpdatePod(key string) error {
klog.Errorf("failed to add static route, %v", err)
return err
}
} else {
} else if c.config.EnableEipSnat {
if err := c.ovnLegacyClient.DeleteStaticRoute(podIP, c.config.ClusterRouter); err != nil {
return err
}
Expand Down
10 changes: 8 additions & 2 deletions pkg/ovs/ovn-nbctl-legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1385,8 +1385,14 @@ func (c LegacyClient) DeleteStaticRoute(cidr, router string) error {
if cidr == "" {
return nil
}
_, err := c.ovnNbCommand(IfExists, "lr-route-del", router, cidr)
return err
for _, cidrBlock := range strings.Split(cidr, ",") {
if _, err := c.ovnNbCommand(IfExists, "lr-route-del", router, cidrBlock); err != nil {
klog.Errorf("fail to delete static route %s from %s, %v", cidrBlock, router, err)
return err
}
}

return nil
}

func (c LegacyClient) DeleteStaticRouteByNextHop(nextHop string) error {
Expand Down

0 comments on commit 27d22b7

Please sign in to comment.