srl-labs / clabernetes

containerlab, but in kubernetes!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unique namespace per lab

hellt opened this issue · comments

Currently, clabverter uses clabernetes namespace for the resources created for every clab file.

I think it makes sense to create a unique namespace per each lab as it:

  1. makes it easy to remove the lab and its artifacts with a single swipe: k del ns foo
  2. isolates lab resources in the cluster, which makes it easy to list resources belonging to a lab
  3. simplifies visualization in tools like k9s

The namespace name can be bluntly derived from the clab's .name attribute plus c9s prefix. For example for a given clab file:

name: mylab

topology:
  nodes:
# snip

clabverter can create a namespace named c9s-mylab making a homage to clab's prefix naming convention that would have been clab-mylab.

I think we already have a namespace flag in clabverter -- so basically have that take precedence over this but otherwise do this auto magic handling?

@carlmontanari I can work on that.

the scope of work I see ahead is:

  1. get the lab name out of the clab file
  2. compute that c9s-<lab-name> namespace
  3. set this value as a namespace of clabverter