Documentation ¶
Index ¶
Constants ¶
View Source
const MaxDNSNameLength = 63
MaxDNSNameLength is the limit for some resources Name fields where they can be used as DNS names per RFC 1035.
View Source
const MaxK8SValueLength = 253
MaxK8sValueLength is the limit for names that can be used as DNS subdomain values per RFC 1123. https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names
Variables ¶
View Source
var ErrEmptyName = invalidName("DNS name can not be empty")
ErrEmptyName is returned if an empty string is provided for sanitising.
Functions ¶
func SanitizeDNSDomain ¶
DNS subdomains are DNS labels separated by '.', max 253 characters.
func SanitizeDNSName ¶
SanitizeDNSName sanitizes a string suitable for use in K8s resources that require a DNS 1035 compatible name.
The name returned from here must conform to following rules (as per RFC 1035):
- length must be <= 63 characters
- must be all lower case alphanumeric characters or '-'
- must start with an alphabet
- must end with an alphanumeric character
Types ¶
type InvalidNameError ¶
type InvalidNameError struct {
// contains filtered or unexported fields
}
InvalidNameError is returned when a name can't be sanitized.
func (InvalidNameError) Error ¶
func (m InvalidNameError) Error() string
Click to show internal directories.
Click to hide internal directories.