Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pkg/formatting/k8labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ var (
)

// CleanValueKubernetes conforms a string to kubernetes naming convention
// see https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names
// rules are:
// β€’ contain at most 63 characters
// β€’ contain only alphanumeric characters or '-', '.', and '_'
// β€’ start with an alphanumeric character
// β€’ end with an alphanumeric character.
// see https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set.
// Valid label value:
// * must be 63 characters or less (can be empty),
// * unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]),
// * could contain dashes (-), underscores (_), dots (.), and alphanumerics between.
func CleanValueKubernetes(s string) string {
// cut short if the string is already a valid label
if len(validation.IsValidLabelValue(s)) == 0 {
Expand Down
Loading