Skip to content

Conversation

aritrbas
Copy link
Collaborator

@aritrbas aritrbas commented Sep 11, 2025

Removed pubsub dependency from peers_watcher.go for node state changes and BGP secret changes so that we can remove pubsub altogether. Now, the PeerManager acts as the single coordination point.

  1. The PeerManager is responsible for creating (i) PeerHandler (ii) PeerWatcher (iii) SecretWatcher and registering the handlers for BGP secret and node state changes.
  2. Each watcher (SecretWatcher & PeerWatcher) now maintains a list of handlers to notify directly, rather than broadcasting events via pubsub.
  3. All dependencies are registered in the PeerManager at startup:
  • PeerHandler is registered with the ConnectivityHandler for node state changes.
  • PeerManager is registered with the SecretWatcher for secret changes, and forwards those to the PeerHandler.
  1. All the different components now interact via well-defined interfaces:
  • SecretChangeHandler to handle BGP secret changes.
  • SecretGetter to fetch BGP secrets.

PeerHandler

  • Implements all the core BGP logic for adding, updating, and deleting peers.
  • Implements the OnSecretChanged method to handle secret changes.
  • Implements the SecretGetter and SecretCleanupHandler interfaces to fetch and clean up unused secrets.

PeerWatcher

  • Monitors BGP peers configured in Calico and notifies the PeerHandler directly for processing when peers are added, updated, or deleted.

SecretWatcher

  • Monitors changes in Kubernetes secrets and notifies registered handlers (PeerHandler via the PeerManager).

Connectivity Handler

  • Notifies the PeerHandler of node state changes when nodes join/leave the cluster.

Made 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.

Signed-off-by: Aritra Basu <aritrbas@cisco.com>
@aritrbas aritrbas force-pushed the abasu-peers-watcher-rem-pubsub branch from 6fee584 to 2c22c24 Compare October 1, 2025 04:18
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.

1 participant