From 409dec7d2d9160b022747a2f27e811648b135f72 Mon Sep 17 00:00:00 2001 From: Maksim Nabokikh Date: Sat, 6 Jan 2024 16:32:16 +0100 Subject: [PATCH] Fix empty keychain panic (#110) Signed-off-by: m.nabokikh --- pkg/registry/checker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/registry/checker.go b/pkg/registry/checker.go index 0802359..99189f8 100644 --- a/pkg/registry/checker.go +++ b/pkg/registry/checker.go @@ -326,7 +326,11 @@ func check(ref name.Reference, kc authn.Keychain, registryTransport *http.Transp // Fallback to default keychain if image is not found in the provided one. // This is a behavior that is close to what CRI does. Because, there is maybe an image pull secret, but with // the wrong credentials. Yet, the image may be available with the default keychain. - kc = authn.NewMultiKeychain(kc, authn.DefaultKeychain) + if kc != nil { + kc = authn.NewMultiKeychain(kc, authn.DefaultKeychain) + } else { + kc = authn.DefaultKeychain + } _, imgErr = remote.Head( ref,