Documentation ¶
Overview ¶
Package names provides functions for truncating and hashing strings and for generating valid k8s resource names.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HelmReleaseName ¶
HelmReleaseName uses the provided string to create a unique name. The resulting name is DNS label safe (RFC1123) and complies with Helm's regex for release names.
func Hex ¶
Hex returns a hex-encoded hash of the string and truncates it to length. Warning: truncating the 32 character hash makes collisions more likely.
func KeyHash ¶
KeyHash returns the first 12 hex characters of the hash of the first 100 chars of the input string
func Limit ¶
Limit the length of a string to count characters. If the string's length is greater than count, it will be truncated and a separator will be appended to the end, followed by a hash. If the last character of the truncated string is the separator, then the separator itself is omitted. This prevents the result from containing two consecutive separators. In such a case, the result will be [count -1] characters long. If count is too small to include the shortened hash the string is simply truncated.
func SafeConcatName ¶
SafeConcatName concatenates the given strings and ensures the returned name is under 64 characters by cutting the string off at 57 characters and setting the last 6 with an encoded version of the concatenated string.
Types ¶
This section is empty.