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

store: expose blob API for allowing additional layer store to export lazy layers #322

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

ktock
Copy link
Member

@ktock ktock commented May 14, 2021

This is eStargz implementation of containers/storage#902.

Currently, layers acquired from the stargz store cannot be exported (e.g. podman save and podman push fail) as mentioned in containers/storage#795 (comment). For solving this issue, a new API blob is proposed to the additional layer store (containers/storage#902). This file exposes the raw contents of that layer.

This commit implements this API. For more details about blob API, please refer to containers/storage#902.

This also adds the following annotation to the image created from nativeconverter.

  • io.containers.estargz.uncompressed-size : contains the uncompressed size of the layer.

For exporting a layer, the additional layer store (stargz store) needs to expose that layer's uncompressed size through info file. However, the current OCI image doesn't contain this information by default. So we need this special annotation.

demo

(stargz-store is required)

Lazily pulled image can run:

# podman pull ghcr.io/ktock/python:3.9-esgz-storage
Trying to pull ghcr.io/ktock/python:3.9-esgz-storage...
Getting image source signatures
Copying blob 0180433592e1 skipped: already exists
... (performs lazy pull) ...
# podman run --rm -it ghcr.io/ktock/python:3.9-esgz-storage echo hello
hello

Lazily pulled image can save and push:

# podman save ghcr.io/ktock/python:3.9-esgz-storage > /tmp/python.tar
# cat /tmp/python.tar | tar --list
6c853b792e30742d9696a6817feb2229ab0f46cf54f3a3b663811252c2f73502.tar
...
# podman tag ghcr.io/ktock/python:3.9-esgz-storage ghcr.io/ktock/python:3.9-esgz-storage-repush
# podman push ghcr.io/ktock/python:3.9-esgz-storage-repush

Note that re-pushed image isn't eStargz anymore because podman re-compresses the blob in the non-eStargz way.
TOC digest annotations are also eliminated.

# podman pull ghcr.io/ktock/python:3.9-esgz-storage-repush
{"error":"failed to resolve layer: failed to resolve layer \"ghcr.io/ktock/python:3.9-esgz-storage-repush\" / \"sha256:35ffa438f5d9b28c29e6519690c7ee1bbd395cc873e23bc222314a9c069af60d\": failed to read layer: failed to parse stargz: error parsing footer: 2 error(s) occurred:\n\t* gzip: invalid header\n\t* legacy: failed to get footer gzip reader: gzip: invalid header","layerdigest":"sha256:35ffa438f5d9b28c29e6519690c7ee1bbd395cc873e23bc222314a9c069af60d","level":"debug","msg":"error resolving layer (context error: \u003cnil\u003e)","remote-snapshot-prepared":"false","time":"2021-05-27T01:36:46.405188322Z"}
... (performs non-lazy pull) ...

@ktock ktock marked this pull request as ready for review May 27, 2021 02:57
@ktock ktock requested a review from AkihiroSuda May 27, 2021 02:57
@ktock
Copy link
Member Author

ktock commented Jun 1, 2021

@AkihiroSuda PTAL 🙏

@@ -23,6 +23,7 @@ ORG_IMAGE_TAG="${REGISTRY_HOST}/test/test:org$(date '+%M%S')"
OPT_IMAGE_TAG="${REGISTRY_HOST}/test/test:opt$(date '+%M%S')"
NOOPT_IMAGE_TAG="${REGISTRY_HOST}/test/test:noopt$(date '+%M%S')"
TOC_JSON_DIGEST_ANNOTATION="containerd.io/snapshot/stargz/toc.digest"
UNCOMPRESSED_SIZE_ANNOTATION="io.containers.estargz.uncompressed-size"
Copy link
Member

Choose a reason for hiding this comment

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

Is this a typo of "containerd" or intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

This label isn't used by containerd but used by podman/CRI-O so it's intentional.

@AkihiroSuda AkihiroSuda merged commit b858a39 into containerd:master Jun 1, 2021
@ktock ktock mentioned this pull request Jun 1, 2021
@ktock ktock deleted the store-blob branch June 1, 2021 13:49
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