From f97856d7998cd64736ee33c19229e19c69f4c9fe Mon Sep 17 00:00:00 2001 From: oilbeater Date: Mon, 8 Jul 2024 10:10:41 +0000 Subject: [PATCH] when router is deleted return success for static route deletion Signed-off-by: oilbeater --- pkg/ovs/ovn-nb-logical_router_route.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/ovs/ovn-nb-logical_router_route.go b/pkg/ovs/ovn-nb-logical_router_route.go index 421f3a76ec5..35ae1ac542a 100644 --- a/pkg/ovs/ovn-nb-logical_router_route.go +++ b/pkg/ovs/ovn-nb-logical_router_route.go @@ -136,12 +136,17 @@ func (c *OVNNbClient) UpdateLogicalRouterStaticRoute(route *ovnnb.LogicalRouterS return nil } -// DeleteLogicalRouterStaticRoute add a logical router static route +// DeleteLogicalRouterStaticRoute delete a logical router static route func (c *OVNNbClient) DeleteLogicalRouterStaticRoute(lrName string, routeTable, policy *string, ipPrefix, nexthop string) error { if policy == nil || len(*policy) == 0 { policy = ptr.To(ovnnb.LogicalRouterStaticRoutePolicyDstIP) } + lr, err := c.GetLogicalRouter(lrName, true) + if lr == nil && err == nil { + return nil + } + routes, err := c.ListLogicalRouterStaticRoutes(lrName, routeTable, policy, ipPrefix, nil) if err != nil { klog.Error(err)