Skip to content

Commit

Permalink
Merge pull request #17496 from justinmchase/master
Browse files Browse the repository at this point in the history
fix(image-repository): allow subdomains with numbers
  • Loading branch information
spowelljr authored Mar 19, 2024
2 parents 3e514bf + 410000e commit 3e67840
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 16 additions & 1 deletion cmd/minikube/cmd/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -395,7 +411,6 @@ func TestValidateImageRepository(t *testing.T) {
}
})
}

}

func TestValidateDiskSize(t *testing.T) {
Expand Down

0 comments on commit 3e67840

Please sign in to comment.