Skip to content

Commit e9b016f

Browse files
smiralaurazard
andcommitted
fix: use strict platform match when pulling images
It only applies to Talos pulling images, not CRI-initiated pulls. This more of an experiment to fight a random issue when a wrong platform image is pulled (specifically on arm64 platform accidentally pulling amd64 image). Co-authored-by: Laura Brehm <laurabrehm@hey.com> Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent fafab39 commit e9b016f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

internal/pkg/containers/image/image.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/containerd/containerd/v2/core/images"
1616
"github.com/containerd/errdefs"
1717
"github.com/containerd/log"
18+
"github.com/containerd/platforms"
1819
"github.com/distribution/reference"
1920
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2021
"github.com/siderolabs/go-retry/retry"
@@ -122,6 +123,7 @@ func Pull(ctx context.Context, registryBuilder RegistriesBuilder, client *contai
122123
containerd.WithPullUnpack,
123124
containerd.WithResolver(resolver),
124125
containerd.WithChildLabelMap(images.ChildGCLabelsFilterLayers),
126+
containerd.WithPlatformMatcher(platforms.OnlyStrict(platforms.DefaultSpec())),
125127
); err != nil {
126128
err = fmt.Errorf("failed to pull image %q: %w", ref, err)
127129
if errors.Is(err, errdefs.ErrNotFound) {

0 commit comments

Comments
 (0)