srl-labs / clabernetes

containerlab, but in kubernetes!
BSD 3-Clause "New" or "Revised" License
51 stars 9 forks source link

Do not append parent path if the path is absolute and sanitize node names #131

Closed hellt closed 6 months ago

hellt commented 6 months ago

1 Handle absolute paths for startup configs, license and extra files

Some file paths are given in the abs format (mostly licenses that are kept centrally like in /opt/nokia/sros/lic.key. This PR prevents those paths to be FQDN'ed since they are FQDN enough already.

Underscore in the lab and node names

(I am still thinking about it, currently thinking let the user handle it themselves :D)

This is somewhat a bigger (?) problem. If an original lab definition contains underscores either in a node name or a lab name the lab will burst in flames. This is due to the same DNS label rules.

At the same time it is not uncommon to see underscores in the clab files. So I was thinking where this can be fixed. And I see the following options:

  1. leave it as it is, maybe add an error if underscores are detected. Least preferred, as this becomes a user's problem which they might not want to solve.
  2. use clabverter and substitute all underscored strings with dashes. A sane alternative, should only affect the initial raw config string, but seems very hard to implement, because underscores can be seen in the file names, kinds...
  3. implement a custom unmarshaller (done in this pr) that would apply the enforceDNSLabel processing on all node names and lab name. This works, but introduces another problem where the raw config doesn't match the processed one. I think I will have to try (2) variant instead.

3 VS Code and go directive in

vscode went batshit crazy with go version being 1.22, until I set it to 1.22.1

It couldn't find the toolchain, which is a new thing since 1.21, but I am not sure why it can't live with 1.22 go directive.

Since this was also noticed by other users I think it is not too bad to set it to the full min version value (1.22.1)

hellt commented 6 months ago

Closing this stuff in favor of #132

I leave behind the brackets the problem of underscores in the topo (at this moment)