Documentation ¶
Overview ¶
Package names collects functions encapsulating the rules for constructing a variety of kube resource names
Index ¶
- Constants
- func DNSLabelSafe(name string) string
- func GenerateResourceName(names ...string) string
- func GenerateResourceNameTruncated(originalName string, maxLen int) string
- func MD5String(value string, length int) string
- func ReleaseName(base string) string
- func ServiceHelmChartName(name, namespace string) string
- func Truncate(s string, maxLen int) string
Constants ¶
const (
Sha1sumLength = 40 // The length of a sha1sum checksum
)
Variables ¶
This section is empty.
Functions ¶
func DNSLabelSafe ¶ added in v0.8.0
DNSLabelSafe filters invalid characters and returns a string that is safe to use as Kubernetes resource name.
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names
func GenerateResourceName ¶ added in v0.0.22
func GenerateResourceNameTruncated ¶ added in v0.8.0
GenerateResourceNameTruncated joins the input strings with dashes("-") and returns the checksum of the produced string after removing any characters that are invalid for kubernetes resource names and prefixing the checksum with up to (maxLen - Sha1sumLength) characters of the original string. It concatenates the prefix with the checksum with a "-". This way the generated name: - is always valid for a resource name - is never longer than maxLen characters - has low probability of collisions NOTE: Since the checksum must always be included, this function shouldn't be used to produce names shorter than Sha1sumLength characters.
func MD5String ¶ added in v1.1.0
MD5String compute the hash of the passed value and returns the first 'length' characters If the length is -1 or greater than the md5 hash then the whole hash is returned
func ReleaseName ¶ added in v0.6.0
ReleaseName returns the name of a helm release derived from the base string.
func ServiceHelmChartName ¶ added in v0.9.0
Types ¶
This section is empty.