New ๐ŸŒŠ wave for @helm

Commit bbb7ecf0

bbb7ecf094fdMerged

Dmitriy Zhilyaev <[email protected]> ยท 2 years ago ยท 1 file ยท ~1 modified

Description

fix: more RE

Signed-off-by: Dmitriy Zhilyaev [email protected]

Details

Commit
bbb7ecf094fd
Parent
795263541835

pkg/release/uniqname/uniqname.gomodifiedView file

@@ -9,7 +9,11 @@
99 // Separator is a separator between release Name and Namespace.
1010 const Separator = "@"
1111
12-var validateRegexp = regexp.MustCompile("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
12+var (
13+ NamespaceRegexp = regexp.MustCompile("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
14+ KubecontextRegexp = regexp.MustCompile("^[a-z0-9]([-a-z0-9_]*[a-z0-9])?$")
15+ ReleaseRegexp = regexp.MustCompile("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
16+)
1317
1418 // UniqName is a unique identificator for release.
1519 type UniqName struct {
@@ -56,15 +60,15 @@
5660
5761 // Validate validates this object.
5862 func (n UniqName) Validate() error {
59- if !validateRegexp.MatchString(n.Name) {
63+ if !ReleaseRegexp.MatchString(n.Name) {
6064 return NewValidationError(n.String())
6165 }
6266
63- if !validateRegexp.MatchString(n.Namespace) {
67+ if !NamespaceRegexp.MatchString(n.Namespace) {
6468 return NewValidationError(n.String())
6569 }
6670
67- if n.Context != "" && !validateRegexp.MatchString(n.Context) {
71+ if n.Context != "" && !KubecontextRegexp.MatchString(n.Context) {
6872 return NewValidationError(n.String())
6973 }
7074