Skip to content

Commit

Permalink
fix: dst route policy might be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed May 20, 2020
1 parent aa0fd0d commit 92ccf72
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (c *Controller) gcStaticRoute() error {
return err
}
for _, route := range routes {
if route.Policy == ovs.PolicyDstIP {
if route.Policy == ovs.PolicyDstIP || route.Policy == "" {
if !c.ipam.ContainAddress(route.NextHop) {
klog.Infof("gc static route %s %s %s", route.Policy, route.CIDR, route.NextHop)
if err := c.ovnClient.DeleteStaticRouteByNextHop(route.NextHop); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/ovs/ovn-nbctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ func (c Client) ListStaticRoute() ([]StaticRoute, error) {
for _, entry := range strings.Split(output, "\n") {
if len(strings.Split(entry, ",")) == 3 {
t := strings.Split(entry, ",")
staticRoutes = append(staticRoutes, StaticRoute{CIDR: t[0], NextHop: t[1], Policy: t[2]})
staticRoutes = append(staticRoutes,
StaticRoute{CIDR: strings.TrimSpace(t[0]), NextHop: strings.TrimSpace(t[1]), Policy: strings.TrimSpace(t[2])})
}
}
return staticRoutes, nil
Expand Down

0 comments on commit 92ccf72

Please sign in to comment.