openconfig / kne

Apache License 2.0
217 stars 65 forks source link

Create topology in specific namespace #260

Open raballew opened 2 years ago

raballew commented 2 years ago

As described here I would like to use KNE and deploy a topology into a specific namespace. Unfortunately, it seems that KNE lacks some convenience features such taking into account the current context set in the kubeconfig files or allowing the definition of the target namespace similar to kubectl create -n ... and always deploys the topology in the namespace defined by the name parameter in the topology file.

So far, the only workaround I have found seems to be modifying in the topology file at runtime as shown below.

namespace=3-node-ceos-with-traffic
kubectl create namespace $namespace
echo "name: \"$namespace\"" >> topology.pb.txt
kne create topology.pb.txt --kubecfg $KUBECONFIG
alexmasi commented 1 year ago

The KNE cli currently uses the name of the topology to keep track of the topology for deletion:

https://github.com/openconfig/kne/blob/fe05480a25c5fbcd0aed75fa4092de0bc10a19c0/topo/topo.go#L184

Currently the CLI is stateless, although we do have an FR open to make a central KNE controller that would be inside of the cluster. This central controller would do all of the work that the CLI currently does in a stateful way. Then the CLI would just push all of the work on the controller. This would allow support for this FR.

If you have a solution to this problem using a flag to override the topology name, while also keeping the kne delete <topo file> functionality then I would review a PR

raballew commented 1 year ago

I will have a look as soon as I can find some time.

Is there anyone working on the feature request already? Is this FR about implement ing a controller or an operator managing its own CRs? I could not find an issue referring to this on GitHub but I also would like to contribute to this FR.

alexmasi commented 1 year ago

@guoshiuan for info about the stateful KNE controller, probably best to open an issue here on GitHub if you will accept external contribution on this

guoshiuan commented 1 year ago

Sorry for late response. The design is still in progress. For your reference, here is the one-page for the current status and future plan: https://docs.google.com/document/d/1HjlCAKbYSgl0KgGRQYZu5PJioOrmTTcK40vgICBVx8s/edit?usp=sharing&resourcekey=0-4w894QWjS6ZR9OVbRH1uZg.

raballew commented 1 year ago

It seems that the document is private. I have requested access and would be happy to contribute to the feature.