names

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package names collects functions encapsulating the rules for constructing a variety of kube resource names

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDNS1123SubDomainName

func GenerateDNS1123SubDomainName(names ...string) string

GenerateDNS1123SubDomainName joins the input strings with dots (".") and returns the result, suitably truncated to the maximum length allowed for the domain names.

func GenerateResourceName added in v0.0.22

func GenerateResourceName(names ...string) string

GenerateResourceName joins the input strings with dots (".") and returns the result, suitably truncated to the maximum length of kube resource names.

func IngressName added in v0.0.22

func IngressName(base string) string

IngressName returns the name of a kube ingress derived from the base string. It ensures that things like leading digits are sufficiently hidden to prevent kube from erroring out on the name. It also replaces "/" characters with "-" to produce a valid resource name from a route (which may contain "/" characters).

func ServiceName added in v0.0.22

func ServiceName(base string) string

ServiceName returns the name of a kube service derived from the base string. It ensures that things like leading digits are sufficiently hidden to prevent kube from erroring out on the name.

func TruncateMD5

func TruncateMD5(s string, maxLen int) string

TruncateMD5 truncates the input string s to the maxLen, if necessary. Shorter strings are passed through unchanged. Truncation is done by computing an MD5 hash over the __entire__ string and then combining it with the (maxLen-32)-sized prefix of the input. This result in a string of exactly maxLen characters. The magic 32 is the length of the 16 byte MD5 hash in hex characters.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL