names

package
v0.0.142 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: Apache-2.0 Imports: 4 Imported by: 9

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

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSlug = errors.New("Current inputs produce an invalid slug")
)

Functions

func GetNamespaceLessSlug added in v0.0.139

func GetNamespaceLessSlug(slug, namespace string) (string, error)

func ImageInfoToSlug

func ImageInfoToSlug(image, imageHash string) (string, error)

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

func InstanceIDToSlug(name, namespace, kind, hashedID string) (string, error)

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

func IsValidDNSLabelName

func IsValidDNSLabelName(s string) bool

IsValidDNSLabelName returns true if a given string is a valid DNS label name as defined in the Kubernetes docs

func IsValidDNSSubdomainName

func IsValidDNSSubdomainName(s string) bool

IsValidDNSSubdomainName returns true if a given string is a valid DNS Subdomain name as defined in the Kubernetes docs

func IsValidSlug

func IsValidSlug(s string) bool

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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