cilium icon indicating copy to clipboard operation
cilium copied to clipboard

hubble: refactor the local node watcher as a cell

Open kaworu opened this issue 10 months ago • 0 comments

Evaluate whether it would be beneficial to refactor the Hubble local node watcher as a cell.

https://github.com/cilium/cilium/blob/44facedceffc694c7a4c289c3054cb91757ffda1/pkg/hubble/cell/hubbleintegration.go#L259-L265

The required plumbing is already available in the form of observeroption.Option hive/cell registration. However, I'm not 100% sure extracting it in a cell is the cleanest way forward.

For context, the local node watcher was implemented as a OnDecodedFlow hook because I didn't want to trickle down yet another dependency deep into the hubble parsers which looked like this. It is historically the feature that made me realize we had to refactor Hubble and its components cells to handle dependency injection cleanly.

Now that the top-level parser is a cell having it depends on the nodeLocalStore and managing the hubble local node watcher should be considered, especially if the sub-parsers are refactored as cells (see https://github.com/cilium/cilium/issues/40065). Additionally, since the local node watcher is mutating the flow we want its hook to run as soon as possible (i.e. before other hooks) and so as-is it adds additional constraints on the hook ordering.

kaworu avatar Jun 16 '25 14:06 kaworu