We follow the DNS standards:
Domain names may be formed from the set of alphanumeric ASCII characters (a-z, A-Z, 0-9), but characters are case-insensitive. In addition the hyphen is permitted if it is surrounded by characters, digits or hyphens, although it is not to start or end a label. Labels are always separated by the full stop (period) character in the textual name representation.
It is checked and enforced by the provisioning system, as the HAT core does not affect routing or addressing in any way.
With our current provisioning system, based on Kubernetes, subdomain length is limited to 22 characters:
Service names are restricted to DNS 952 labels (24 characters)
Of those 24 characters, 2 are used to indicate a HAT service, hence we are left with 22. In theory that would be 63 characters allowed by the DNS standard for subdomains, once that is supported: