Skip to content

Conversation

@sohankunkerkar
Copy link

This adds support for using Spegel with CRI-O by implementing a new CRIoClient that accesses CRI-O's image content cache for P2P distribution.

There's a PR in-flight to add support for storing tar image content in CRI-O.

Copilot AI review requested due to automatic review settings December 4, 2025 20:43

This comment was marked as spam.

This comment was marked as spam.

This adds support for using Spegel with CRI-O by implementing a new
CRIoClient that accesses CRI-O's image content cache for P2P distribution.

Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
@sohankunkerkar
Copy link
Author

@phillebaba Could you take a look at it?

Copy link
Member

@phillebaba phillebaba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start to get CRIO support in Spegel. I have some questions regarding the implementation that seems like they add more complexity than needed. The main ones right now is the optional store and then the lack of the ns optional parameter. The latter is a bit tricky as it requires changes to CRIO.

I and thinking about if it is better to split this feature into a few PRs. The main things missing right now are integration tests for CRIO like the ones that we have with Containerd. I dont know if we have an option to run something similar to Kind but OpenShift that would allow tests. These things are important long term to ensure future stability.

//
// Supports two formats:
// 1. Containerd: /v2/<repository>/manifests/<ref>?ns=<registry>
// 2. CRI-O: /v2/<registry>/<repository>/manifests/<ref> (registry embedded in path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if CRIO added the ns parameter to the request, as it is now merged in the OCI distribution spec. We need to discuss this more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I have already raised a PR here to get some consensus.

MirrorResolveTimeout time.Duration `arg:"--mirror-resolve-timeout,env:MIRROR_RESOLVE_TIMEOUT" default:"20ms" help:"Max duration spent finding a mirror."`
MirrorResolveRetries int `arg:"--mirror-resolve-retries,env:MIRROR_RESOLVE_RETRIES" default:"3" help:"Max amount of mirrors to attempt."`
DebugWebEnabled bool `arg:"--debug-web-enabled,env:DEBUG_WEB_ENABLED" default:"true" help:"When true enables debug web page."`
CRIOImageContentCacheDir string `arg:"--crio-image-content-cache-dir,env:CRIO_IMAGE_CONTENT_CACHE_DIR" default:"/var/lib/containers/storage/image-content-cache" help:"Path to CRI-O image content cache directory. If this path exists, CRI-O mode is used."`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to think about the future of the configuration here. Maybe it is better to rethink this properly.


// CRIoClient accesses CRI-O's image content cache and containers/storage for P2P distribution.
// It serves both layer blobs (from image content cache) and manifests/configs (from containers/storage).
type CRIoClient struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this to CRIO to match Containerd.

}

// containers/storage is optional - it may not be accessible in nested container environments.
var store storage.Store
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we make the store optional? I have trouble understanding why Spegel would run in a nested container environment without access to the store?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove that comment. I think that's for the testing purpose.

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