From dceeff4441647166c2fb6489ddc1811397d37617 Mon Sep 17 00:00:00 2001 From: yudong2015 <2091381910@qq.ccom> Date: Thu, 16 May 2019 12:37:42 +0800 Subject: [PATCH] namespace support all numbers --- pkg/service/runtime_provider/kubernetes_handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/service/runtime_provider/kubernetes_handler.go b/pkg/service/runtime_provider/kubernetes_handler.go index 0503f62..5a4c4ce 100644 --- a/pkg/service/runtime_provider/kubernetes_handler.go +++ b/pkg/service/runtime_provider/kubernetes_handler.go @@ -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) ) @@ -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)