Add support for push endpoints to registry server #977
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/andPUT /manifests/endpoints). The new endpoints are only handled when thePushconfig-flag is enabled (defaultfalse).An optional
PushUpstreamextension (defaultfalse) asynchronously pushes uploaded images back to the upstream registry, and a temporary lease (LeaseDuration, default10m) 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.Clientdirectly and doesn't include any tests. The next step would probably be to abstract the implementation into correspondingoci.Store/oci.Clientinterfaces 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.