Skip to content

Conversation

@wjordan
Copy link

@wjordan wjordan commented Aug 14, 2025

This PR is an attempt at #545, making it possible to push to Spegel by implementing a subset of the OCI Distribution specification's endpoints related to pushing images in the registry server (the /blobs/uploads/ and PUT /manifests/ endpoints). The new endpoints are only handled when the Push config-flag is enabled (default false).

An optional PushUpstream extension (default false) asynchronously pushes uploaded images back to the upstream registry, and a temporary lease (LeaseDuration, default 10m) is placed on newly created content and images to prevent them from being immediately garbage collected.

My use-case for this feature is to have Spegel act as a proxy for an upstream image push while making it immediately available in the local mirror, which can significantly improve latency and network usage compared to having the image perform a round-trip to/from the remote upstream registry.


This PR works well enough for my use-case at this point. I'd like feedback and guidance on whether this seems like a decent enough approach for being eventually merged into the main project with some further work.

The implementation currently uses the containerd client.Client directly and doesn't include any tests. The next step would probably be to abstract the implementation into corresponding oci.Store / oci.Client interfaces and add some tests against an in-memory implementation. Also open to any more specific (or entirely different) directions you'd like to go with this implementation as well.

Implements blob and manifest uploads by writing directly to the Containerd client's content and image store.
Optionally asynchronously pushes uploaded images to the upstream registry.
Adds a temporary lease to newly created content and images to prevent them from being immediately garbage collected.
@phillebaba
Copy link
Member

@wjordan thank you for the contribution! Adding the ability to push to Spegel has a lot of nuances that are not immediately. The main one is that it introduces a level of state fullness as users pushing images to Spegel would expect them to be persisted. If the node the image was pushed to is removed for whatever reason that image would no longer be available. Additionally any image push would have to be done to a specific node to assure that the complete image has been pushed.

I have been doing some experimentation in Primsa, the enterprise offering for Spegel, to implement replication factors to allow instances to push layers in between each other to create a distributed stateful store. The reality is that the maintenance cost of such a feature does not make it feasible to add to Spegel. Especially because it becomes very difficult to debug during the initial development without access to the Kubernetest clusters.

I am happy to discuss things further in Slack or during the community call to understand the specific problem you are trying to solve better, and maybe suggest alternative solutions to your problem.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants