Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit ad5dcc6

Browse files
authored
Merge pull request #1254 from awesomenix/release/1.2
[release/1.2] fix: support empty auth config for anonymous registry
2 parents 0ee5925 + ce727ba commit ad5dcc6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/server/image_pull.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ func ParseAuth(auth *runtime.AuthConfig) (string, string, error) {
166166
return user, strings.Trim(passwd, "\x00"), nil
167167
}
168168
// TODO(random-liu): Support RegistryToken.
169-
return "", "", errors.New("invalid auth config")
169+
// An empty auth config is valid for anonymous registry
170+
return "", "", nil
170171
}
171172

172173
// createImageReference creates image reference inside containerd image store.

pkg/server/image_pull_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ func TestParseAuth(t *testing.T) {
4141
expectErr bool
4242
}{
4343
"should not return error if auth config is nil": {},
44-
"should return error if no supported auth is provided": {
44+
"should not return error if empty auth is provided for access to anonymous registry": {
4545
auth: &runtime.AuthConfig{},
46-
expectErr: true,
46+
expectErr: false,
4747
},
4848
"should support identity token": {
4949
auth: &runtime.AuthConfig{IdentityToken: "abcd"},

0 commit comments

Comments
 (0)