networkop / meshnet-cni

a (K8s) CNI plugin to create arbitrary virtual network topologies
BSD 3-Clause "New" or "Revised" License
116 stars 28 forks source link

Move clientset implementation to use dynamic client and add a fake + tests #69

Closed alexmasi closed 1 year ago

alexmasi commented 1 year ago

This change also removes the Type and Obj Meta fields from the subfields of the Topology struct as they are unused, they do not need to be treated as runtime objects during code gen

networkop commented 1 year ago

Thanks Alex, can you explain what is the benefit of a dynamic clientset?

alexmasi commented 1 year ago

To give some more context on this change:

We (KNE) had been developing a clientset (https://github.com/openconfig/kne/blob/main/api/clientset/v1beta1/topology.go) for the Topology CRD, wasn't aware that this one existed (appears it was merged from changes by marcushines a while ago). I am looking to contribute those changes here and delete our unintended fork.

Since that divergence we have made changes to the clientset that have eased unit testing. The fake is much easier to use as it more closely mirrors the standard k8 clientset. So you can load runtime.Object's into the clientset. You can see some examples of testing with the fake dynamic client in the added test for the topology clientset