Add support for pulling Wasm OCI artifacts#8699
Add support for pulling Wasm OCI artifacts#8699jsturtevant wants to merge 4 commits intocontainerd:mainfrom
Conversation
|
Hi @jsturtevant. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
| } | ||
| if len(diffIDs) != len(manifest.Layers) { | ||
|
|
||
| // parse out the image layers from oci artifact layers |
There was a problem hiding this comment.
This is similar to what transfer service does: https://github.com/containerd/containerd/blob/main/pkg/unpack/unpacker.go#L188
| } | ||
| } | ||
|
|
||
| func WithWasmLayers(descriptors []v1.Descriptor) SpecOpts { |
There was a problem hiding this comment.
Other options I considered was using something like WithOciArtifacts which would add the layers to annotations if not a "imagelayer" and put this behind a flag in ctr
There was a problem hiding this comment.
Using []v1.Descriptor directly seems a bit blatant (I'm not sure if that's the right word, so forgive me if it's not), and I'm also thinking about whether there are better function names and arguments
There was a problem hiding this comment.
I am open to suggestions
There was a problem hiding this comment.
The descriptors seems like exactly what we need here since what we want is for the shim to pull these out of the content store. The function needs a list of mediatypes+digests.
re: function name: WithAnnotateWasmObjects?
There was a problem hiding this comment.
maybe I could pass the whole manifest? Is that what you mean @Iceber?
that would also allow for usage of the artifacttype field on which maybe something that gets set in the future when oci 1.1 is released.
|
/cc @cpuguy83 |
images/mediatypes.go
Outdated
|
|
||
| // OCI media types | ||
|
|
||
| MediaTypeWasmLayerModule = "application/vnd.w3c.wasm.module.v1+wasm" |
There was a problem hiding this comment.
Is this media type approved by W3C?
Otherwise “vnd.w3c” doesn’t seem correct.
There was a problem hiding this comment.
These types are not set in stone. I got the from https://hackmd.io/50rfwV6BTJWN8VZBhdAN_g and bytecodealliance/registry#87.
I needed something to test with but I need some input on long term types and best way to have a type that we can begin using in containerd and testing to prove out this work.
One option I considered was to not have any types in containerd and have the WithWasmLayers be WithOciArtifact and it would just add any layers it didn't recognize but not sure I'd adding anything at all os a good idea.
There was a problem hiding this comment.
There is a wasm type registered in https://www.iana.org/assignments/media-types/media-types.xhtml
There was a problem hiding this comment.
Maybe we should do vnd.containerd...?
I suspect this will need to converge on a more generic name soon (especially after we introduce something) but it seems wrong to create one using w3c's name here.
There was a problem hiding this comment.
Agree. vnd.containerd is interesting idea.
I would like to be in agreement with what lands in bytecodealliance/registry#87, so we don't have to there aren't to many changes on containerd side.
Any thoughts on making it more generic in the time being? Something like WithOciArtifact so it would add any layers it didn't recognize to the annotation?
There was a problem hiding this comment.
Oh maybe a vnd.bytecodealliance could work?
There was a problem hiding this comment.
Just that it could end up blocking progress.
There was a problem hiding this comment.
Hi folks. I got pinged...
For defining unique types, there documentation under: OCI/Artifacts: Defining a Unique Artifact Type that might be helpful. It explains [registration-tree].[org|company|entity].[objectType].[optional-subType].config.[version]+[optional-configFormat]
|
Why don't you the oci-iamge-spec also be updated? |
I'm not sure it makes sense to update the spec until we have settled on media types. |
The idea behind OCI Artifacts is artifact authors, such as the Wasm community, can create their own types without being dependent on OCI. The only reason to register with IANA.org is to assure you own the definition of that schema. |
|
@cpuguy83 @SteveLasker Thanks for the explanation. I understand your plans and respect it 🙏 |
|
Quick update, we got this working e2e (https://www.youtube.com/watch?v=SEwBcEFgXUM&feature=youtu.be) with bytecodealliance/registry#146 using Still finalizing the media types and should be good to go once those are confirmed in bytecodealliance/registry#146 |
5ba67fd to
144854a
Compare
Signed-off-by: James Sturtevant <jstur@microsoft.com>
Signed-off-by: James Sturtevant <jstur@microsoft.com>
Signed-off-by: James Sturtevant <jstur@microsoft.com>
Signed-off-by: James Sturtevant <jstur@microsoft.com>
144854a to
aa384a6
Compare
|
after some feedback and a few iterations, I found that the only changes needed are allowing artifact layers to pull #9142. please take a look and if we are good with that approach I can close this out. |
This adds the ability to pass OCI artifact information to the shim via annotations. This came up as part of containerd/runwasi#108 and bytecodealliance/registry#87 in Runwasi. It solves challenges for Runwasi like:
I've shared a document with the wasm groups on an approach and other things tried. You can read more details in https://docs.google.com/document/d/11shgC3l6gplBjWF1VJCWvN_9do51otscAm0hBDGSSAc/edit
I've got a demo to view at https://1drv.ms/v/s!AgI8NTf7Sd1R-ZU5FH523s3CGiYvuQ?e=m6EZTb
additional information
I have a few questions about the best way to bring this in now and have commented on the PR it's self but looking for feedback. Thanks!
Runwasi requires some changes: containerd/runwasi#147
Sample way to build an artifact: https://github.com/containerd/runwasi/tree/main/crates/oci-tar-builder#executable-usage
Example Artifact: