Skip to content

Commit

Permalink
Fix error loop caused by failure to delete a route
Browse files Browse the repository at this point in the history
When a LoadBalancer with ingress IP is created, corresponding route
for the ingress IP is also installed. When deleting the LoadBalancer,
corresponding route should be also uninstalled. Before uninstalling
the route, if the route is removed, then deleting the route will
get a failure and return an error. The error will trigger the event
of delete the LoadBalancer again, obviously, deleting the route will
get a failure and return an error another time, resulting in an error
loop. This PR fixes the error loop by logging a warning instead of
returning an error when deleting route for ingress IP.

Signed-off-by: Hongliang Liu <lhongliang@vmware.com>
  • Loading branch information
hongliangl committed May 25, 2022
1 parent 9425c61 commit 07c9930
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/agent/route/route_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1298,9 +1298,10 @@ func (c *Client) deleteLoadBalancerIngressIPRoute(svcIPStr string) error {

route := generateRoute(svcIP, mask, gw, linkIndex, netlink.SCOPE_UNIVERSE)
if err := netlink.RouteDel(route); err != nil {
return fmt.Errorf("failed to delete routing entry for LoadBalancer ingress IP %s: %w", svcIP.String(), err)
klog.Warningf("Failed to delete routing entry for LoadBalancer ingress IP %s: %w", svcIP.String(), err)
} else {
klog.V(4).InfoS("Deleted LoadBalancer ingress IP route", "route", route)
}
klog.V(4).InfoS("Deleted LoadBalancer ingress IP route", "route", route)
c.serviceRoutes.Delete(svcIP.String())

return nil
Expand Down

0 comments on commit 07c9930

Please sign in to comment.