Skip to content

load: import all platforms (--all-platforms)#316

Merged
AkihiroSuda merged 1 commit into
containerd:masterfrom
cpuguy83:platform_on_load
Aug 20, 2021
Merged

load: import all platforms (--all-platforms)#316
AkihiroSuda merged 1 commit into
containerd:masterfrom
cpuguy83:platform_on_load

Conversation

@cpuguy83
Copy link
Copy Markdown
Member

Currently if you try to import a non-native image the blobs will get
GC'd and unpack fails with with "not found" on the blobs.

Import doesn't really have a way to select which platforms to important,
so I don't think it makes sense to make this optional. After all the tar
could just be modified with the desired platforms.

@cpuguy83 cpuguy83 requested a review from AkihiroSuda August 17, 2021 23:33
@AkihiroSuda AkihiroSuda added this to the v0.12.0 milestone Aug 18, 2021
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be gated with --all-platforms as in nerdctl image convert --all-platforms OLD NEW .

// platform flags
&cli.StringSliceFlag{
Name: "platform",
Usage: "Convert content for a specific platform",
Value: &cli.StringSlice{},
},
&cli.BoolFlag{
Name: "all-platforms",
Usage: "Convert content for all platforms",
},

In addition to nerdctl load, nerdctl pull should follow the same semantics, though PR for nerdctl pull can be worked out separately
(Obviously nobody wants all the platforms to be pulled by default)

@AkihiroSuda AkihiroSuda mentioned this pull request Aug 18, 2021
5 tasks
@fahedouch
Copy link
Copy Markdown
Member

Hello,

@cpuguy83 I do not agree with you. the import retrieves the platform to import from the client which is platforms.DefaultStrict()

the platform is applied on the client here :

client, ctx, cancel, err := newClient(clicontext, containerd.WithDefaultPlatform(platforms.DefaultStrict()))

so then the import function will get it and initialize the platformMatcher with platforms.DefaultStrict() :
https://github.com/containerd/containerd/blob/fda782a7b941de5438e4fbbd38675bf23b69304b/import.go#L128

I agree with @AkihiroSuda making all-platforms by default is not the it is not the best choice. I think we should keep platforms.DefaultStrict() and add --all-platforms flag

@cpuguy83
Copy link
Copy Markdown
Member Author

Either way is fine.
My main point is the user is supplying the tar to import. It seems strange to not import the whole tar, especially since it seems to be importing them anyway.

@cpuguy83
Copy link
Copy Markdown
Member Author

Added the --all-platforms flag.

@cpuguy83 cpuguy83 requested a review from AkihiroSuda August 18, 2021 18:05
@fahedouch
Copy link
Copy Markdown
Member

LGTM

Comment thread cmd/nerdctl/load.go Outdated
},
&cli.BoolFlag{
Name: "all-platforms",
Usage: "Imports content for all platforms, false by default",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"false by default" can be removed, as urfave/cli/v2 appends (default: false) automatically

@AkihiroSuda AkihiroSuda changed the title load: import all platforms load: import all platforms (--all-platforms) Aug 19, 2021
Currently if you try to import a non-native image the blobs will get
GC'd and unpack fails with with "not found" on the blobs.

Import doesn't really have a way to select which platforms to important,
so I don't think it makes sense to make this optional. After all the tar
could just be modified with the desired platforms.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants