pub fn sanitize_node_name(name: &str) -> StringExpand description
name as a valid RFC 1035 label, the strictest rule any provider applies to
a node’s name (a kubernetes service name): lowercase letters, digits and
-, starting with a letter and ending with a letter or digit, at most
NODE_NAME_MAX_LEN characters.
- Uppercase letters are lowercased (
Collator-1000->collator-1000). - Any other character becomes
-(my_node.1->my-node-1). - Leading and trailing
-are dropped, and a name that then doesn’t start with a letter gets anode-prefix (1st->node-1st). - It’s cut to
NODE_NAME_MAX_LEN.
An empty name stays empty, so it’s still reported as one. A valid name is returned unchanged, so this can be applied any number of times.