Skip to content

Commit

Permalink
namespace support all numbers
Browse files Browse the repository at this point in the history
namespace support all numbers
  • Loading branch information
yudong2015 authored May 16, 2019
2 parents 7af3adb + dceeff4 commit 4a275b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/service/runtime_provider/kubernetes_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
)

var (
NamespaceReg = `^[a-z]([-a-z0-9]*[a-z0-9])?$`
NamespaceReg = `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
NamespaceRegExp = regexp.MustCompile(NamespaceReg)
)

Expand Down Expand Up @@ -318,7 +318,7 @@ func (p *KubeHandler) ValidateRuntime(zone string, runtimeCredential *models.Run
zone = "default"
}
if !NamespaceRegExp.MatchString(zone) {
err := fmt.Errorf(`namespace must match with regexp "[a-z0-9]([-a-z0-9]*[a-z0-9])?"`)
err := fmt.Errorf(`namespace must match with regexp "%s"`, NamespaceReg)
return gerr.NewWithDetail(nil, gerr.PermissionDenied, err, gerr.ErrorNamespaceNotMatchWithRegex, zone, NamespaceReg)
}
client, _, err := p.initKubeClientWithCredential(runtimeCredential.RuntimeCredentialContent)
Expand Down

0 comments on commit 4a275b7

Please sign in to comment.