Merge pull request #45531 from rumpl/24.0_backport_fix-empty-auth-pull

[24.0 backport] c8d: The authorizer needs to be set even if AuthConfig is empty
This commit is contained in:
Akihiro Suda 2023-05-12 19:02:16 +09:00 committed by GitHub
commit a5b597ea51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,10 +27,7 @@ func (i *ImageService) newResolverFromAuthConfig(authConfig *registrytypes.AuthC
func hostsWrapper(hostsFn docker.RegistryHosts, optAuthConfig *registrytypes.AuthConfig, regService RegistryConfigProvider) docker.RegistryHosts {
var authorizer docker.Authorizer
if optAuthConfig != nil {
auth := *optAuthConfig
if auth != (registrytypes.AuthConfig{}) {
authorizer = docker.NewDockerAuthorizer(authorizationCredsFromAuthConfig(auth))
}
authorizer = docker.NewDockerAuthorizer(authorizationCredsFromAuthConfig(*optAuthConfig))
}
return func(n string) ([]docker.RegistryHost, error) {