Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Support mirror registries with path component (#1707)" #1794

Merged
merged 2 commits into from
Oct 21, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions pkg/image/remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ func RetrieveRemoteImage(image string, opts config.RegistryOptions, customPlatfo
}

for _, registryMirror := range opts.RegistryMirrors {
var newRepo name.Repository
var newReg name.Registry
if opts.InsecurePull || opts.InsecureRegistries.Contains(registryMirror) {
newRepo, err = name.NewRepository(registryMirror, name.WeakValidation, name.Insecure)
newReg, err = name.NewRegistry(registryMirror, name.WeakValidation, name.Insecure)
} else {
newRepo, err = name.NewRepository(registryMirror, name.StrictValidation)
newReg, err = name.NewRegistry(registryMirror, name.StrictValidation)
}
if err != nil {
return nil, err
}
ref := setNewRepository(ref, newRepo)
ref := setNewRegistry(ref, newReg)

logrus.Infof("Retrieving image %s from registry mirror %s", ref, registryMirror)
remoteImage, err := remote.Image(ref, remoteOptions(registryMirror, opts, customPlatform)...)
Expand Down Expand Up @@ -113,19 +113,6 @@ func normalizeReference(ref name.Reference, image string) (name.Reference, error
return ref, nil
}

func setNewRepository(ref name.Reference, newRepo name.Repository) name.Reference {
switch r := ref.(type) {
case name.Tag:
r.Repository = newRepo
return r
case name.Digest:
r.Repository = newRepo
return r
default:
return ref
}
}

func setNewRegistry(ref name.Reference, newReg name.Registry) name.Reference {
switch r := ref.(type) {
case name.Tag:
Expand Down