Documentation ¶
Index ¶
- Constants
- func HasString(value string, values []string) bool
- func Hash(value string, hashLength int) string
- func HelmConformName(name string) string
- func Intersection(set1, set2 []string) []string
- func IsPathExists(path string) bool
- func K8sConformName(name string, logger *zerolog.Logger) string
- func ListeningAddress(port int) string
- func S3ConformName(name string) string
- func ShortenedName(name string, maxLength, hashLength int) string
- func StructToMap(data interface{}) (map[string]interface{}, error)
Constants ¶
const ( StepNameHashLength = 10 S3MaxConformNameLength = 63 K8sMaxNameLength = names.MaxGeneratedNameLength - 1 // We keep extra space for a "-" )
Variables ¶
This section is empty.
Functions ¶
func HelmConformName ¶
Conforms a string to be a Helm-compatible. Currently only shortens the name. Helm has stricter restrictions than K8s and restricts release names to 53 characters.
func Intersection ¶
Intersection finds a common subset of two given sets of strings
func IsPathExists ¶
Given a path this function returns true if such path exists. Otherwise it returns false.
func K8sConformName ¶
Conforms a string to be a k8s compatible for an object name. The method first validates the name is a valid DNS subdomain, and hashes otherwise. In case the string is a valid DNS subdmain, the method shortens the name keeping a prefix and adds a hash of the suffix. The final output length is ActualMaxGeneratedNameLength.
func ListeningAddress ¶
func S3ConformName ¶ added in v1.3.0
Conforms a string to be a S3-compatible bucket name. Currently only shortens the name.
func ShortenedName ¶
This function shortens a name to the maximum length given and uses rest of the string that is too long as hash that gets added to the valid name.
func StructToMap ¶
StructToMap converts a struct to a map using JSON marshal
Types ¶
This section is empty.