Help us shape the future of Go! Take the 2026 Go Developer Survey

names

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 57

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateHashedName added in v0.59.0

func GenerateHashedName(prefix, name string, hashedLength int) string

GenerateHashedName creates a unique name with a hashed suffix.

Types

type NameGenerator

type NameGenerator interface {
	// RestrictLengthWithRandomSuffix generates a valid name from the base name, adding a random suffix to
	// the base. If base is valid, the returned name must also be valid. The generator is
	// responsible for knowing the maximum valid name length.
	RestrictLengthWithRandomSuffix(base string) string

	// RestrictLength generates a valid name from the name of a step specified in a Task,
	// shortening it to the maximum valid name length if needed.
	RestrictLength(base string) string
}

NameGenerator generates names for objects. Some backends may have more information available to guide selection of new names and this interface hides those details.

var SimpleNameGenerator NameGenerator = simpleNameGenerator{}

SimpleNameGenerator is a generator that returns the name plus a random suffix of five alphanumerics when a name is requested. The string is guaranteed to not exceed the length of a standard Kubernetes name (63 characters)

Jump to

Keyboard shortcuts

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