Skip to content

Commit 9860888

Browse files
smirak8s-infra-cherrypick-robot
authored andcommitted
fix: set the credentials even if not provided
Fixes #10916 Signed-off-by: Andrey Smirnov <[email protected]>
1 parent 78795fa commit 9860888

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

internal/cri/server/images/image_pull.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,20 @@ func (c *CRIImageService) PullImage(ctx context.Context, name string, credential
133133
defer inProgressImagePulls.Dec()
134134
startTime := time.Now()
135135

136+
if credentials == nil {
137+
credentials = func(host string) (string, string, error) {
138+
var hostauth *runtime.AuthConfig
139+
140+
config := c.config.Registry.Configs[host]
141+
if config.Auth != nil {
142+
hostauth = toRuntimeAuthConfig(*config.Auth)
143+
144+
}
145+
146+
return ParseAuth(hostauth, host)
147+
}
148+
}
149+
136150
namedRef, err := distribution.ParseDockerRef(name)
137151
if err != nil {
138152
return "", fmt.Errorf("failed to parse image reference %q: %w", name, err)

0 commit comments

Comments
 (0)