Skip to content
Permalink
Browse files
fix(slugification): kubernetes namespace and release name cannot cont…
…ain dots

Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
  • Loading branch information
alexey-igrychev committed Apr 4, 2022
1 parent abffc62 commit e22eecb91ce04d5af10c83cbed21db6518008d9c
Showing with 4 additions and 4 deletions.
  1. +4 −4 pkg/slug/slug.go
@@ -148,12 +148,12 @@ func ValidateKubernetesNamespace(namespace string) error {
}

func validateKubernetesNamespace(name string) error {
errorMsgPrefix := fmt.Sprintf("kubernetes namespace should be a valid DNS-1123 subdomain")
errorMsgPrefix := fmt.Sprintf("kubernetes namespace should be a valid DNS-1123 label")
if len(name) == 0 {
return nil
} else if len(name) > kubernetesNamespaceMaxSize {
return fmt.Errorf("%s: %q is %d chars long", errorMsgPrefix, name, len(name))
} else if msgs := validation.IsDNS1123Subdomain(name); len(msgs) > 0 {
} else if msgs := validation.IsDNS1123Label(name); len(msgs) > 0 {
return fmt.Errorf("%s: %s", errorMsgPrefix, strings.Join(msgs, ", "))
}
return nil
@@ -171,12 +171,12 @@ func ValidateHelmRelease(name string) error {
}

func validateHelmRelease(name string) error {
errorMsgPrefix := fmt.Sprintf("helm release name should be a valid DNS-1123 subdomain and be maximum %d chars", helmReleaseMaxSize)
errorMsgPrefix := fmt.Sprintf("helm release name should be a valid DNS-1123 label and be maximum %d chars", helmReleaseMaxSize)
if len(name) == 0 {
return nil
} else if len(name) > helmReleaseMaxSize {
return fmt.Errorf("%s: %q is %d chars long", errorMsgPrefix, name, len(name))
} else if msgs := validation.IsDNS1123Subdomain(name); len(msgs) > 0 {
} else if msgs := validation.IsDNS1123Label(name); len(msgs) > 0 {
return fmt.Errorf("%s: %s", errorMsgPrefix, strings.Join(msgs, ", "))
}
return nil

0 comments on commit e22eecb

Please sign in to comment.