Skip to content

Commit

Permalink
Fixes #3086 - amd64 images always pulled irrespective of underlying s…
Browse files Browse the repository at this point in the history
…ystem architecture
  • Loading branch information
bahetiamit authored and tekton-robot committed Oct 9, 2020
1 parent 1160686 commit e2f528b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/pod/entrypoint_lookup_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package pod
import (
"context"
"fmt"
"runtime"

"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/authn/k8schain"
Expand Down Expand Up @@ -68,7 +69,15 @@ func (e *entrypointCache) Get(ctx context.Context, ref name.Reference, namespace
return nil, fmt.Errorf("error creating k8schain: %v", err)
}
mkc := authn.NewMultiKeychain(kc)
img, err := remote.Image(ref, remote.WithAuthFromKeychain(mkc))
// By default go-containerregistry pulls amd64 images.
// Setting correct image pull architecture based on the underlying platform
// _of the node that Tekton's controller is running on_. If the cluster
// is comprised of nodes of heterogeneous architectures, this might cause issues.
var pf = v1.Platform{
Architecture: runtime.GOARCH,
OS: runtime.GOOS,
}
img, err := remote.Image(ref, remote.WithAuthFromKeychain(mkc), remote.WithPlatform(pf))
if err != nil {
return nil, fmt.Errorf("error getting image manifest: %v", err)
}
Expand Down

0 comments on commit e2f528b

Please sign in to comment.