Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SanitizeLabelValue ¶ added in v0.82.0
SanitizeLabelValue maps a containerlab name onto the value of a Kubernetes label: at most 63 characters, made up of a-z, A-Z, 0-9, '-', '_' and '.', starting and ending with an alphanumeric character. Unlike SanitizeName it keeps the case the topology used, so a label selector matches the name the clab file spells out verbatim.
The mapping is deterministic and idempotent: a name Kubernetes already accepts as a label value maps onto itself. The result is empty only for a name holding no character a label value can be built from.
func SanitizeName ¶
SanitizeName maps a containerlab name onto the DNS-1035 label a lab runtime can name the objects it creates with: lower case, made up of a-z, 0-9 and '-', starting with a letter and at most 63 characters long. A large share of public labs name their nodes R1/PE_1 or capitalize the lab name, and Kubernetes cannot carry those names as they are -- renaming them beats making the user edit every reference in the topology.
The mapping is deterministic and idempotent: a name Kubernetes already accepts maps onto itself, so a sanitized name coming back from the runtime -- or typed by a user reading it off containerlab output -- resolves to the same object. The result is empty only for a name holding nothing a Kubernetes name can be built from.
func SanitizeNodeNames ¶
SanitizeNodeNames returns the sanitized name of every node name that needs one, keyed by the name the topology uses. Node names Kubernetes can carry as they are are absent from the result.
Two node names that differ only in something Kubernetes cannot carry (R1 and r1) would collapse onto one object, so that is reported as an error instead of silently merging the two nodes.
Types ¶
This section is empty.