[refactor] split routeWatcher into watcher and handler components#797
Open
aritrbas wants to merge 1 commit into
Open
[refactor] split routeWatcher into watcher and handler components#797aritrbas wants to merge 1 commit into
aritrbas wants to merge 1 commit into
Conversation
9763990 to
eeacc54
Compare
sknat
reviewed
Oct 17, 2025
sknat
left a comment
Collaborator
There was a problem hiding this comment.
thanks ! A few comments inline,
I think we could split the uplink_route_watcher in half and simplify the logic even more,
tell me if things are unclear !
eeacc54 to
4574268
Compare
fe46ca8 to
0b13f6d
Compare
Signed-off-by: Aritra Basu <aritrbas+gh@cisco.com>
0b13f6d to
9cae52e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This refactors the
RouteWatchercomponent by separating the route watching functionality from the route handling logic.Previously, the
RouteWatcherused to (i) monitor netlink route updates and address changes and (ii) respond to network and IPAM configuration events via pubsub. Because of this, theRouteWatcherneeded to be passed to theNetWatcherjust so it could subscribe to events, and the event handling logic was mixed with route watching logic.Now, we have a new handler component
RouteHandlerthat implements three event handling methods:OnNetDeleted(netDef *common.NetworkDefinition) errorOnNetAddedOrUpdated(netDef *common.NetworkDefinition) errorOnIpamConfChanged(oldPool, newPool *proto.IPAMPool) errorand holds a reference to
RouteWatcherto perform route operations.The
RouteWatcheris now purely focused on route watching. It no longer subscribes to pubsub or performs any event handling. It is only responsible for netlink route/address monitoring.NetWatcherand IPAM configuration changes now directly call theRouteHandlerinstead of sending pubsub events resulting in network and IPAM events being synchronously processed when they occur.NetWatcherno longer needs to know aboutRouteWatcher, it only knows about theRouteHandlerinterface.Events are now processed directly:
NetWatcher→RouteHandler→RouteWatcherPreviously:
NetWatcher→SendEvent→PubSub→RouteWatcher.eventChan→RouteWatcherMade the changes on top of the nsk-split-svc branch for now, will rebase on top of master once those commits for single thread agent are merged.