Fix different registry hosts referencing the same auth config.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
1b05b605c8
commit
81402e4758
@ -375,21 +375,25 @@ func (c *criService) registryHosts(ctx context.Context, auth *runtime.AuthConfig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make a copy of `auth`, so that different authorizers would not reference
|
||||||
|
// the same auth variable.
|
||||||
|
auth := auth
|
||||||
if auth == nil && config.Auth != nil {
|
if auth == nil && config.Auth != nil {
|
||||||
auth = toRuntimeAuthConfig(*config.Auth)
|
auth = toRuntimeAuthConfig(*config.Auth)
|
||||||
}
|
}
|
||||||
|
authorizer := docker.NewDockerAuthorizer(
|
||||||
|
docker.WithAuthClient(client),
|
||||||
|
docker.WithAuthCreds(func(host string) (string, string, error) {
|
||||||
|
return ParseAuth(auth, host)
|
||||||
|
}))
|
||||||
|
|
||||||
if u.Path == "" {
|
if u.Path == "" {
|
||||||
u.Path = "/v2"
|
u.Path = "/v2"
|
||||||
}
|
}
|
||||||
|
|
||||||
registries = append(registries, docker.RegistryHost{
|
registries = append(registries, docker.RegistryHost{
|
||||||
Client: client,
|
Client: client,
|
||||||
Authorizer: docker.NewDockerAuthorizer(
|
Authorizer: authorizer,
|
||||||
docker.WithAuthClient(client),
|
|
||||||
docker.WithAuthCreds(func(host string) (string, string, error) {
|
|
||||||
return ParseAuth(auth, host)
|
|
||||||
})),
|
|
||||||
Host: u.Host,
|
Host: u.Host,
|
||||||
Scheme: u.Scheme,
|
Scheme: u.Scheme,
|
||||||
Path: u.Path,
|
Path: u.Path,
|
||||||
|
Loading…
Reference in New Issue
Block a user