Skip to content

Commit

Permalink
support image-repository contain numeric characters
Browse files Browse the repository at this point in the history
Signed-off-by: Allen <allenhaozi@github.com>
  • Loading branch information
allenhaozi committed Mar 4, 2024
1 parent 29200a2 commit ae35871
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,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
12 changes: 12 additions & 0 deletions cmd/minikube/cmd/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,18 @@ 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",
},
}

for _, test := range tests {
Expand Down

0 comments on commit ae35871

Please sign in to comment.