naming

package
v0.1.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxK8sNameLen is the Kubernetes DNS-1123 label limit.
	MaxK8sNameLen = 63

	// MaxWorkloadNameLen is the safe max for TrainJob names,
	// leaving room for JobSet pod suffixes. The longest replicatedJob name
	// is "launcher", giving suffix "-launcher-{N}-{hash}" ~18 chars.
	MaxWorkloadNameLen = 44

	// MaxJobNameLen is the safe max for Job names,
	// leaving room for the "-workload" suffix (9 chars).
	MaxJobNameLen = 35

	// MaxWorkflowNameLen is the safe max for Workflow names,
	// leaving room for "-job" (4 chars) + "-workload" (9 chars) downstream.
	MaxWorkflowNameLen = 31
)

Variables

This section is empty.

Functions

func ExtractHash

func ExtractHash(name string) string

ExtractHash returns the trailing hash from a Truncate'd name. e.g., "gpu-cluster-cert-communic-873b9" → "873b9". If the name has no hash (no hyphen or too short), returns a computed hash.

func Truncate

func Truncate(name string, maxLen int) string

Truncate returns name unchanged if it fits within maxLen. Otherwise, it truncates to (maxLen - 6) characters, strips trailing hyphens, and appends "-{5-char FNV-32a hash}" of the full original name. The result is deterministic: same input always produces the same output.

Types

This section is empty.

Jump to

Keyboard shortcuts

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