Skip to content

Commit

Permalink
fix: delete static route should consider dualstack (#2130)
Browse files Browse the repository at this point in the history
(cherry picked from commit 27d22b7)
  • Loading branch information
oilbeater committed Dec 6, 2022
1 parent d17c4dd commit e37f63a
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 @@ -869,7 +869,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 @@ -1180,8 +1180,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 e37f63a

Please sign in to comment.