From 78ab9b1e2d21baa0c765529a2aebc048017af04b Mon Sep 17 00:00:00 2001 From: Mengxin Liu Date: Mon, 31 Aug 2020 23:32:51 +0800 Subject: [PATCH] fix: do not gc learned routes --- pkg/controller/gc.go | 1 + pkg/ovs/ovn-nbctl.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/controller/gc.go b/pkg/controller/gc.go index e996570958f..c3384150892 100644 --- a/pkg/controller/gc.go +++ b/pkg/controller/gc.go @@ -301,6 +301,7 @@ func (c *Controller) gcPortGroup() error { } func (c *Controller) gcStaticRoute() error { + klog.Infof("start to gc static routes") routes, err := c.ovnClient.ListStaticRoute() if err != nil { klog.Errorf("failed to list static route %v", err) diff --git a/pkg/ovs/ovn-nbctl.go b/pkg/ovs/ovn-nbctl.go index b9949698542..9b113e0bf4a 100644 --- a/pkg/ovs/ovn-nbctl.go +++ b/pkg/ovs/ovn-nbctl.go @@ -336,7 +336,7 @@ type StaticRoute struct { } func (c Client) ListStaticRoute() ([]StaticRoute, error) { - output, err := c.ovnNbCommand("--format=csv", "--no-heading", "--data=bare", "--columns=ip_prefix,nexthop,policy", "list", "Logical_Router_Static_Route") + output, err := c.ovnNbCommand("--format=csv", "--no-heading", "--data=bare", "--columns=ip_prefix,nexthop,policy", "find", "Logical_Router_Static_Route", "external_ids{=}{}") if err != nil { return nil, err }