-
Notifications
You must be signed in to change notification settings - Fork 380
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
copy: replicate manifest list instances with zstd
compression on ReplicateZstd:true
#1875
Conversation
zstd
compression on ReplicateZstd: true
zstd
compression on ReplicateZstd:true
Extends copy to support a new operation when copying a manifest list from `src` to `dest` i.e `ReplicateZstd`. When `ReplicateZstd` is set to `true` and copy operation is performed for a manifest list then a copy for all the image will be created and added to the manifest list with compression as `zstd` and appropriate annotation i.e `"io.github.containers.compression.zstd": "true"` will be set on each image. The CLI tools must use `ReplicateZstd` flag in order to use this new feature. Example with skopeo * Here src `docker://localhost:5000/list` only contains two gzip compressed image but while copying skopeo will replicated zstd instances as well ```console $ ./skopeo copy --all --src-tls-verify=false --dest-tls-verify=false docker://localhost:5000/list docker://localhost/list Getting image list signatures Copying 4 of 4 images in list Copying image sha256:915468dd2aae5e243dbb8d38afc445e8971f7076deade33b81128fdfa42a17a4 (1/4) Getting image source signatures Copying blob f5763aacc581 done Copying blob 0aa932d79126 done Copying config ba4505248d done Writing manifest to image destination Storing signatures Copying image sha256:f08c3c433a2c73ba643800326a825493a862a438857a227f01ae63e0aa6f3896 (2/4) Getting image source signatures Copying blob 1d86523f4719 done Copying blob 0aa932d79126 done Copying config 1ea47b71b3 done Writing manifest to image destination Storing signatures Copying image sha256:915468dd2aae5e243dbb8d38afc445e8971f7076deade33b81128fdfa42a17a4 (3/4) Getting image source signatures Copying blob f5763aacc581 done Copying blob 0aa932d79126 done Copying config ba4505248d done Writing manifest to image destination Storing signatures Copying image sha256:f08c3c433a2c73ba643800326a825493a862a438857a227f01ae63e0aa6f3896 (5/4) Getting image source signatures Copying blob 1d86523f4719 done Copying blob 0aa932d79126 done Copying config 1ea47b71b3 done Writing manifest to image destination Storing signatures Writing manifest list to image destination Storing list signatures ``` * output ```json $ skopeo inspect --tls-verify=false --raw docker://localhost/list | jq { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:915468dd2aae5e243dbb8d38afc445e8971f7076deade33b81128fdfa42a17a4", "size": 759, "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:f08c3c433a2c73ba643800326a825493a862a438857a227f01ae63e0aa6f3896", "size": 759, "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:2a8521136269bf9113cdf9088288a07cce52850d15b958b43aad6da5dc0115fb", "size": 759, "annotations": { "io.github.containers.compression.zstd": "true" }, "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:4feb1d9bf33b2f771dbee9b5ece774f1b6b4dc49b82bce686e47afd13686dcb5", "size": 759, "annotations": { "io.github.containers.compression.zstd": "true" }, "platform": { "architecture": "amd64", "os": "linux" } } ] } ``` Signed-off-by: Aditya R <[email protected]>
6f82118
to
cbb0ba4
Compare
@@ -155,6 +155,9 @@ type Options struct { | |||
// if this is set to OptionalBoolUndefined (which is the default behavior, and recommended for most callers). | |||
// This only affects CopySystemImage. | |||
PreferGzipInstances types.OptionalBool | |||
// While Copying entire manifest list from src to dest, allow each image to be replicated with compression as zstd | |||
// and appropriate annotations configured for each newly compressed image the manifest list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit of a nit
// and appropriate annotations configured for each newly compressed image the manifest list. | |
// and appropriate annotations configured for each newly compressed image in the manifest list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I think this is a good top-level view of what will be necessary, but let’s build the infrastructure in smaller steps.
- (Split
copy/copy.go
into three files #1878 A separate PR to movecopyOneImage
and immediate callees, completely unchanged, intocopy/single.go
, andcopyMultipleImages
etc. tocopy/multiple.go
? It might be time to split thecopy.go
code further.) - copy: move
c.compression*
toimageCopier
#1881 A separate PR to move thecopier.compression*
data intoimageCopier
, and consuming it from there. - (copy/multiple: split selection of images to be copied in
copyMultipleImages
#1982 Maybe a separate PR to split the “what to copy and how” logic ofcopyMultipleImages
into a separate function, with unit tests for the existingCopySpecificImages
logic.) - copy/multiple: use more flexible
EditInstances
instead ofUpdateInstances
#1883 A separate PR to havecopy
use a a new internal-onlyinternal/manifest.List.EditInstances
- manifest: prepare internal
EditInstances
#1896 A PR (possibly combined with the previous one) to add the necessary functionality toEditInstances
; also designed to make Add copy option to strip sparse manifests #1707 possible - A separate PR to ensure existing callers of multi-image copies with
DestinationCtx.CompressionFormat
asking for zstd should (only if the result actually has a zstd layer??) result in that image having the zstd annotation added. - … and then we should have a smaller-scale task ahead of us, focusing on what to copy/convert, and on the semantics/optimizations of individual layer conversion.
It’s almost certainly this PR. (I’m afraid the output is very noisy, but search for
|
As discussed containers#1875 it is suggested to keep the two implementation in different files since there independent complexity is increasing. Signed-off-by: Aditya R <[email protected]>
This will be fully implemented when #1987 is merged, closing this prototype. Thanks for doing all that work! |
Extends copy to support a new operation when copying a manifest list from
src
todest
i.eReplicateZstd
. WhenReplicateZstd
is set totrue
and copy operation is performed for a manifest list then a copy for all the image will be created and added to the manifest list with compression aszstd
and appropriate annotation i.e"io.github.containers.compression.zstd": "true"
will be set on each image.The CLI tools must use
ReplicateZstd
flag in order to use this new feature.Example with skopeo
docker://localhost:5000/list
only contains two gzip compressed image but while copying skopeo will replicated zstd instances as well