Documentation ¶
Overview ¶
Package names defines facilities to work with Kubernetes names
It lets clients validate, transform and process names that can be used in Kubernetes. An example of such transformations would be transforming an Instance ID to a slug. A slug is a human-readable, friendly representation of the full instance ID which is also designed to be compatible with Kubernetes conventions for resource names.
Index ¶
- Variables
- func AddNamespaceToSlug(slug, namespace string) string
- func ImageInfoToSlug(image, imageHash string) (string, error)
- func InstanceIDToSlug(name, kind, containerName, hashedID string) (string, error)
- func IsValidDNSLabelName(s string) bool
- func IsValidDNSSubdomainName(s string) bool
- func IsValidLabelValue(value string) bool
- func IsValidSlug(s string) bool
- func ResourceToSlug(resource workloadinterface.IMetadata) (string, error)
- func RoleBindingResourceToSlug(subject workloadinterface.IMetadata, role workloadinterface.IMetadata, ...) (string, error)
- func SanitizeLabelValues(labels map[string]string)
- func StringToSlug(str string) (string, error)
- func ToValidDNSSubdomainName(input string) (string, error)
- func ToValidLabelValue(input string) string
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidSlug = errors.New("Current inputs produce an invalid slug")
)
Functions ¶
func AddNamespaceToSlug ¶ added in v0.0.155
Add namespace to slug
func ImageInfoToSlug ¶
ImageInfoToSlug returns a human-friendly representation for a given image information
If the given inputs would produce an invalid slug, it returns an appropriate error
func InstanceIDToSlug ¶
InstanceIDToSlug retuns a human-friendly representation given a description of an instance ID
If the given inputs would produce an invalid slug, it returns an appropriate error Deprecated: use InstanceID.GetSlug instead
func IsValidDNSLabelName ¶
IsValidDNSLabelName returns true if a given string is a valid DNS label name as defined in the Kubernetes docs
func IsValidDNSSubdomainName ¶
IsValidDNSSubdomainName returns true if a given string is a valid DNS Subdomain name as defined in the Kubernetes docs
func IsValidLabelValue ¶ added in v0.0.143
isValidLabelValue checks if a string is a valid Kubernetes label value as defined in the Kubernetes docs
func IsValidSlug ¶
IsValidSlug returns true if a given string is a valid slug, else false
A string is considered a valid slug if it can be used as a name of a Kubernetes resource
func ResourceToSlug ¶ added in v0.0.144
func ResourceToSlug(resource workloadinterface.IMetadata) (string, error)
ResourceToSlug returns a human-friendly representation for a given resource The slug is generated based on the kind and name of the resource
func RoleBindingResourceToSlug ¶ added in v0.0.144
func RoleBindingResourceToSlug(subject workloadinterface.IMetadata, role workloadinterface.IMetadata, roleBinding workloadinterface.IMetadata) (string, error)
RoleBindingResourceToSlug returns a human-friendly representation for a given role binding resource The slug is generated based on the subject, role and role binding resources of the role binding
func SanitizeLabelValues ¶ added in v0.0.143
func StringToSlug ¶ added in v0.0.144
StringToSlug receives any string and returns a human-friendly representation of it as a slug
If the given inputs would produce an invalid slug, it returns an appropriate error
func ToValidDNSSubdomainName ¶ added in v0.0.143
func ToValidLabelValue ¶ added in v0.0.143
Types ¶
This section is empty.