Support numbers in subdomains for image registry
parent
65b212b94a
commit
410000eaca
|
@ -1596,7 +1596,7 @@ func validateRegistryMirror() {
|
|||
// args match the format of registry.cn-hangzhou.aliyuncs.com/google_containers
|
||||
// also "<hostname>[:<port>]"
|
||||
func validateImageRepository(imageRepo string) (validImageRepo string) {
|
||||
expression := regexp.MustCompile(`^(?:(\w+)\:\/\/)?([-a-zA-Z0-9]{1,}(?:\.[-a-zA-Z]{1,}){0,})(?:\:(\d+))?(\/.*)?$`)
|
||||
expression := regexp.MustCompile(`^(?:(\w+)\:\/\/)?([-a-zA-Z0-9]{1,}(?:\.[-a-zA-Z0-9]{1,}){0,})(?:\:(\d+))?(\/.*)?$`)
|
||||
|
||||
if strings.ToLower(imageRepo) == "auto" {
|
||||
imageRepo = "auto"
|
||||
|
|
|
@ -384,6 +384,22 @@ func TestValidateImageRepository(t *testing.T) {
|
|||
imageRepository: "registry.test.com:6666/google_containers",
|
||||
validImageRepository: "registry.test.com:6666/google_containers",
|
||||
},
|
||||
{
|
||||
imageRepository: "registry.1test.com:6666/google_containers",
|
||||
validImageRepository: "registry.1test.com:6666/google_containers",
|
||||
},
|
||||
{
|
||||
imageRepository: "registry.t1est.com:6666/google_containers",
|
||||
validImageRepository: "registry.t1est.com:6666/google_containers",
|
||||
},
|
||||
{
|
||||
imageRepository: "registry.test1.com:6666/google_containers",
|
||||
validImageRepository: "registry.test1.com:6666/google_containers",
|
||||
},
|
||||
{
|
||||
imageRepository: "abc.xyz1.example.com",
|
||||
validImageRepository: "abc.xyz1.example.com",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
@ -395,7 +411,6 @@ func TestValidateImageRepository(t *testing.T) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestValidateDiskSize(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue