-
-
Notifications
You must be signed in to change notification settings - Fork 137
Description
Describe the problem to be solved
Spegel relies on the container runtime, when serving OCI artifacts.
This means container image must be known to the underlying container runtime before they can be exchanged among different peers.
While this is without doubt the most important use-case, sideloading arbitrary OCI artifacts could streamline the process of ingesting OCI artifacts from upstream process or sources.
A simple lookup of artifacts from a local filesystem could therefore enable interesting new use-cases for Spegel.
Here is an example use-case on which I face on a regular basis.
To build my container images, I rely on Nix' pkgs.dockerTools.buildLayeredImage, which produces an gzipped OCI image somewhere on the filesystem (e.g. /nix/store/fq1rvmzk1bv8xwlrn3r4xdgk5i5hqzaq-example.tar.gz).
At the moment I need to load this image (e.g. ctr images import /nix/store/fq1rvmzk1bv8xwlrn3r4xdgk5i5hqzaq-example.tar.gz) in order to make the container runtime and therefore Spegel aware of this image.
Sideloading arbitrary OCI artifacts from predefined locations in combination with a simple lookup pattern would expose any built OCI images automatically without explicitly creating them in the container runtime's store.
I have implemented this Nix-specific feature in a standalone read-only OCI registry and would love to bring this to Spegel.
In a proof-of-concept, I integrated this into a fork of Spegel, which I could successfully test in a fork of K3s bundling it.
I believe it's worthwhile to further abstract this feature and support the sideloading of arbitrary OCI artifacts.
Proposed solution to the problem
We could introduce a configuration option specifying the location and pattern of OCI artifacts eligible for sideloading.
This configuration could include values such as:
/nix/store/<ref>-<name>.tar.gz/opt/<name>/<ref>.tar
The first configuration example would sideload OCI artifacts for requests like HEAD /v2/example/manifests/fq1rvmzk1bv8xwlrn3r4xdgk5i5hqzaq, effectively serving the use-case outlined in the problem statement section.
The second configuration example would sideload tar balls in the /opt directory nested further by name and ref.
Even other OCI artifacts than (gzipped) tar balls could be served from configured locations in the filesystem.
I am willing to provide an initial implementation by next week.
Please let me know if further information is needed, and do not hesitate to reach out.