From 9860888666f7e96a37d0a412ee80be065ea74903 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 29 Oct 2024 20:42:02 +0400 Subject: [PATCH] fix: set the credentials even if not provided Fixes #10916 Signed-off-by: Andrey Smirnov --- internal/cri/server/images/image_pull.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/internal/cri/server/images/image_pull.go b/internal/cri/server/images/image_pull.go index e59b88b4f..de8445932 100644 --- a/internal/cri/server/images/image_pull.go +++ b/internal/cri/server/images/image_pull.go @@ -133,6 +133,20 @@ func (c *CRIImageService) PullImage(ctx context.Context, name string, credential defer inProgressImagePulls.Dec() startTime := time.Now() + if credentials == nil { + credentials = func(host string) (string, string, error) { + var hostauth *runtime.AuthConfig + + config := c.config.Registry.Configs[host] + if config.Auth != nil { + hostauth = toRuntimeAuthConfig(*config.Auth) + + } + + return ParseAuth(hostauth, host) + } + } + namedRef, err := distribution.ParseDockerRef(name) if err != nil { return "", fmt.Errorf("failed to parse image reference %q: %w", name, err)