meshnet-cni
                                
                                 meshnet-cni copied to clipboard
                                
                                    meshnet-cni copied to clipboard
                            
                            
                            
                        Add a read-only data api for external and cluster.local tools
This is an initial implementation, but wanted to expose it here for comment and expansion.
The need I had was to dynamically visualize the meshnet topology, and since I already had Grafana deployed I wanted to use the Node Graph panel.
The quick and dirty way to approach this without writing my own complete datasource was to expose the list of topologies (by namespace) at a service API. The fastest way to do that was to just dump the JSON over a REST API, and use the JSON datasource to read and reshape it into something the Node Graph panel can read.
The examples/grafana/ directory has a simple dashboard that massages the TopologyList data and visualizes the result.  The datasource simply taps http://meshnet:51112/v1/meshnet.  The dashboard variable $namespace selects the namespace from which topos will be read.  The "nodes" and "edges" queries provide the two required data frames, using path /topos/${namespace}.
Currently the only thing being visualized is the topology and the Pod status (via containerId; red for no container assigned; green for container assigned). Data is not cached (otherwise the colors don't update right).
A couple screenshots.  A 4-node network (in a line, don't ask) at initial deployment:
And again, after deleting pod lf1 (but not the topology):
This can be merged as-is, or hidden behind a feature flag, or refactored (see below) depending how you want to approach it.
I can also take this a different way; there's a generic gRPC data source. Using this would be more efficient (grpc-gateway not required) but has a bit more code to implement.