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 ServiceReleaseName(base 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 ¶
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 ¶
func GenerateResourceNameTruncated ¶
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 ¶
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 ¶
ReleaseName returns the name of a helm release derived from the base string.
func ServiceHelmChartName ¶
COMPATIBILITY SUPPORT for services from before https://github.com/epinio/epinio/issues/1704 fix
func ServiceReleaseName ¶
ServiceReleaseName returns the name of a helm release derived from the base string.
Types ¶
This section is empty.