Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCI-Image spec conformance #1162

Open
Silvanoc opened this issue Jun 19, 2024 · 5 comments
Open

OCI-Image spec conformance #1162

Silvanoc opened this issue Jun 19, 2024 · 5 comments
Assignees
Milestone

Comments

@Silvanoc
Copy link

Silvanoc commented Jun 19, 2024

Is there a reason why bpfman does not conform with the OCI-image specification?

I mean, it is still using the tool-specific Docker specification, instead of the standardized OCI-image specification.

Other tools using container registries as storage (Helm, cosign, notary,...) are relying on the OCI-image specification. Not only that, some of them are relying on OCI-image v1.1 features.

With OCI-image v1.1 features you can specify the type of the artifact (something like application/vnd.bpfman.package or similar) and of the different provided files (something like application/vnd.bpfman.bytecode).

@Silvanoc
Copy link
Author

FYI the format that you are using was already being considered legacy by Docker 3 years ago.

@Silvanoc
Copy link
Author

Silvanoc commented Jun 19, 2024

Command for diagnosing:
regctl manifest get --format raw-body quay.io/bpfman-bytecode/go-tracepoint-counter|jq -r '.mediaType'

What returns application/vnd.docker.distribution.manifest.v2+json.

@astoycos astoycos self-assigned this Jun 20, 2024
@astoycos
Copy link
Member

astoycos commented Jun 20, 2024

Hiya @Silvanoc! Thanks for opening this, as it's the perfect time for your feedback/ help here while I'm updating the spec in #1141

Is there a reason why bpfman does not conform with the OCI-image specification?

The goal was to eventually ONLY use the OCI-image specification, however originally I ran into issues similar to what WASM images deal with.. i.e there was limitations with existing tooling + registries which is why I focused on writing the backwards compatible spec first. I've been trying to avoid having to implement the image build logic from scratch in bpfman at least at first. However I'm open to scoping out that work. The other issue is that we'd need registry support for custom artifactTypes, which I don't think quay supports at a generic level quite yet.

I mean, it is still using the tool-specific Docker specification, instead of the standardized OCI-image specification.
Other tools using container registries as storage (Helm, cosign, notary,...) are relying on the OCI-image specification. Not only that, some of them are relying on OCI-image v1.1 features.

So when I was looking before at docker + podman there still wasn't any way to build generic images with custom mediaType and artifactType fields (as described in https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidelines-for-artifact-usage) However I am just seeing the ORAS project tooling which might make this easier! https://oras.land/docs/installation

Above all I wanted to ensure that developers could easily package and deploy eBPF programs with existing tooling they're already familiar with.

@Silvanoc
Copy link
Author

Silvanoc commented Jun 20, 2024

What WASM does with what they call the compat format is pretty much what you are doing as of now too, right? Smuggle your payload inside of a container image.

That format provides the best compatibility with old registries, but the worst feature set for new registries. Since registries cannot identify the artifact type in a standardize way, no advanced features (that I am sure are gonna get commodity) can be supported. Just think of a registry UI grouping the artifacts by type and providing a specific icon or similar features.

What they call the oci format is more or less what I would do to be future oriented. But a slight difference: use artifactType (manifest level) to specify the artifact type with something like application/vnd.bpfman.program.

There is an intermediate approach supported by

  • all registries I am aware of
  • tools like regctl and ORAS

--> Use config/mediaType to specify the artifact type. Something that was not clearly specified on OCI-Image v1.0, but mostly supported since the Docker Registry supported it. It is now officially supported on the OCI-Image v1.1. But I consider it somehow a migration path. If I am right, thats what Helm is relying on.

BTW, I would recommend regctl over ORAS. It is very powerful and better aligned with the specification (the maintainer in one of OCI-spec maintainers). It can be used for managing low level elements (indexes, manifests, blobs) and high level elements (images, artifacts,...).

@astoycos
Copy link
Member

astoycos commented Jun 20, 2024

What WASM does with what they call the compat format is pretty much what you are doing as of now too, right? Smuggle your payload into a container image.

100% correct, I got all the inspiration from them :)

That format provides the best compatibility with old registries, but the worst feature set for new registries. Since registries cannot identify the artifact type in a standardize way, no advanced features (that I am sure are gonna get commodity) can be supported. Just think of a registry UI grouping the artifacts by type and providing a specific icon or similar features.

I completely agree which is why I'd like to move towards the newer features, I'm just balancing that desire with time/priorities/other feature commitments.

What they call the oci format is more or less what I would do to be future oriented. But a slight difference: use artifactType (manifest level) to specify the artifact type with something like application/vnd.bpfman.program.

There is an intermediate approach supported by

  • all registries I am aware of
  • tools like regctl and ORAS

--> Use config/mediaType to specify the artifact type. Something that was not clearly specified on OCI-Image v1.0, but mostly supported since the Docker Registry supported it. It is now officially supported on the OCI-Image v1.1. But I consider it somehow a migration path. If I am right, thats what Helm is relying on.

Perfect I'm definitely alright with using config/mediaType for now.

BTW, I would recommend regctl over ORAS. It is very powerful and better aligned with the specification (the maintainer in one of OCI-spec maintainers). It can be used for managing low level elements (indexes, manifests, blobs) and high level elements (images, artifacts,...).

Sounds good I've never played with it before :) but now I'm excited to, I wish they had a rust SDK as that would make things super easy, currently we use https://github.com/krustlet/oci-distribution (which is moving to the ORAS project) for all interactions with container registries.

One of the other larger problems we're facing with eBPF images and the fact that we were using docker/podman for local image caching and therefore couldn't build/run bytecode images locally. i.e a user has to build, push, and then run since bpfman can't directly access the local cache in an abstracted way for both docker and podman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants