Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"strings"
"time"

v1 "github.com/google/go-containerregistry/pkg/v1"
routeclient "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1"
"github.com/openshift/library-go/pkg/controller/factory"
"github.com/openshift/library-go/pkg/operator/events"
Expand Down Expand Up @@ -319,7 +320,10 @@ func convertKrewPlugin(plugin *v1alpha1.Plugin, client *kubernetes.Clientset, dy
}

// attempt to pull the image down locally
img, err := image.Pull(p.Image, imageAuth)
img, err := image.Pull(p.Image, imageAuth, &v1.Platform{
Architecture: fields[1],
OS: fields[0],
})
if err != nil {
newCondition := metav1.Condition{
Status: metav1.ConditionFalse,
Expand Down
6 changes: 5 additions & 1 deletion pkg/image/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
const TarballPath = "/var/run/plugins/"

// Pull an image down to the local filesystem.
func Pull(src string, auth string) (v1.Image, error) {
func Pull(src string, auth string, platform *v1.Platform) (v1.Image, error) {
craneOptions := []crane.Option{}
if len(auth) > 0 {
auth := authn.FromConfig(authn.AuthConfig{
Expand All @@ -28,6 +28,10 @@ func Pull(src string, auth string) (v1.Image, error) {
craneOptions = append(craneOptions, crane.WithAuth(auth))
}

if platform != nil {
craneOptions = append(craneOptions, crane.WithPlatform(platform))
}

return crane.Pull(src, craneOptions...)
}

Expand Down