Skip to content

Commit

Permalink
namespace support all numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
yudong2015 committed May 16, 2019
1 parent 951669f commit dceeff4
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 @@ -32,7 +32,7 @@ import (
)

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 @@ -307,7 +307,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 dceeff4

Please sign in to comment.