Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up code about static routes #2779

Merged
merged 1 commit into from
May 10, 2023
Merged

Conversation

zhangzujian
Copy link
Member

@zhangzujian zhangzujian commented May 9, 2023

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes
  • Docs
  • Tests

Which issue(s) this PR fixes:

Fixes #(issue-number)

WHAT

🤖 Generated by Copilot at 534bb67

This pull request refactors the Controller struct to remove the static routing logic for subnets with centralized gateways. This reduces the complexity and potential errors of the routing management in pkg/controller/controller.go and pkg/controller/subnet.go.

🤖 Generated by Copilot at 534bb67

Controller cleans up
No more static routes for subnets
Autumn leaves fall fast

HOW

🤖 Generated by Copilot at 534bb67

  • Remove deleteRouteQueue field from Controller struct and its initialization and shutdown in Run and shutdown methods (link, link, link)
  • Remove invocation of runDeleteRouteWorker method in startWorkers method of Controller struct (link)
  • Remove conditional logic that adds a subnet to deleteRouteQueue in enqueueDeleteSubnet method of Controller struct (link)
  • Remove definition of runDeleteRouteWorker method and its helper methods processNextDeleteRoutePodWorkItem and handleDeleteRoute from subnet.go file (link, link, link)
  • Remove invocation of deleteStaticRoute method in reconcileOvnDefaultVpcRoute method of Controller struct (link)

@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2023

  • The deleteRouteQueue has been removed from the Controller struct, but it is still being used in the enqueueDeleteSubnet function. This should be updated to remove the call to c.deleteRouteQueue.Add(obj).
  • The runDeleteRouteWorker function has been removed, but it is still being called in the startWorkers function. This should be updated to remove the call to go wait.Until(c.runDeleteRouteWorker, time.Second, ctx.Done()).
  • The handleDeleteRoute function has been removed, but it is still being called in the processNextDeleteRoutePodWorkItem function. This should be updated to remove the call to if err := c.handleDeleteRoute(subnet); err != nil {.
  • The handleUpdateSubnetStatus function is calling c.subnetsLister.Get, which could potentially cause performance issues if there are a large number of subnets. Consider using a cache instead.
  • The reconcileOvnDefaultVpcRoute function is deleting a static route without checking if it exists first. This could result in an error if the route does not exist. Consider adding a check to see if the route exists before attempting to delete it.

@zhangzujian zhangzujian requested a review from oilbeater May 9, 2023 10:02
@zhangzujian zhangzujian marked this pull request as ready for review May 9, 2023 10:12
@zhangzujian zhangzujian merged commit e7190e6 into kubeovn:master May 10, 2023
@zhangzujian zhangzujian deleted the clean branch May 10, 2023 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants