Skip to content

Commit eebc914

Browse files
authored
Merge pull request #5447 from Random-Liu/cherrypick-#5446-release-1.5
[release/1.5] Backport #5446 to release 1.5.
2 parents b60331a + 5e742ea commit eebc914

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

pkg/cri/server/image_pull.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,21 +375,25 @@ func (c *criService) registryHosts(ctx context.Context, auth *runtime.AuthConfig
375375
}
376376
}
377377

378+
// Make a copy of `auth`, so that different authorizers would not reference
379+
// the same auth variable.
380+
auth := auth
378381
if auth == nil && config.Auth != nil {
379382
auth = toRuntimeAuthConfig(*config.Auth)
380383
}
384+
authorizer := docker.NewDockerAuthorizer(
385+
docker.WithAuthClient(client),
386+
docker.WithAuthCreds(func(host string) (string, string, error) {
387+
return ParseAuth(auth, host)
388+
}))
381389

382390
if u.Path == "" {
383391
u.Path = "/v2"
384392
}
385393

386394
registries = append(registries, docker.RegistryHost{
387-
Client: client,
388-
Authorizer: docker.NewDockerAuthorizer(
389-
docker.WithAuthClient(client),
390-
docker.WithAuthCreds(func(host string) (string, string, error) {
391-
return ParseAuth(auth, host)
392-
})),
395+
Client: client,
396+
Authorizer: authorizer,
393397
Host: u.Host,
394398
Scheme: u.Scheme,
395399
Path: u.Path,

0 commit comments

Comments
 (0)