From a29c950229b3e637020976cd885c3666a9e92343 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Sat, 21 Jul 2018 08:44:23 -0400 Subject: [PATCH] Move k8schain usage to image_util.go --- pkg/util/image_util.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/util/image_util.go b/pkg/util/image_util.go index f6aef6fdc2..646f3546c7 100644 --- a/pkg/util/image_util.go +++ b/pkg/util/image_util.go @@ -17,18 +17,20 @@ limitations under the License. package util import ( - "github.com/GoogleContainerTools/kaniko/pkg/constants" + "path/filepath" + "strconv" + "github.com/docker/docker/builder/dockerfile/instructions" "github.com/google/go-containerregistry/pkg/authn" + "github.com/google/go-containerregistry/pkg/authn/k8schain" "github.com/google/go-containerregistry/pkg/name" "github.com/google/go-containerregistry/pkg/v1" "github.com/google/go-containerregistry/pkg/v1/empty" "github.com/google/go-containerregistry/pkg/v1/remote" "github.com/google/go-containerregistry/pkg/v1/tarball" "github.com/sirupsen/logrus" - "net/http" - "path/filepath" - "strconv" + + "github.com/GoogleContainerTools/kaniko/pkg/constants" ) var ( @@ -74,9 +76,11 @@ func remoteImage(image string) (v1.Image, error) { if err != nil { return nil, err } - auth, err := authn.DefaultKeychain.Resolve(ref.Context().Registry) + k8sc, err := k8schain.NewNoClient() if err != nil { return nil, err } - return remote.Image(ref, remote.WithAuth(auth), remote.WithTransport(http.DefaultTransport)) + kc := authn.NewMultiKeychain(authn.DefaultKeychain, k8sc) + return remote.Image(ref, remote.WithAuthFromKeychain(kc)) + }