Commit Graph

311 Commits

Author SHA1 Message Date
Giuseppe Scrivano 31d1330f74
chunked: do not store the digest if it is empty
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-09-03 12:26:19 +02:00
Giuseppe Scrivano 2855d17137
chunked: estargz support
in addition to zstd:chunked, add support for the estargz format.

estargz is maintained at github.com/containerd/stargz-snapshotter

Images using estargz can be used on old clients and registries that
have no support for the zstd compression algorithm.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-25 16:16:20 +02:00
Giuseppe Scrivano 8694b29402
chunked: remove unused args
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-18 09:25:50 +02:00
Giuseppe Scrivano 76e458bfbe
chunked: fix fd leak on error
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-18 08:17:40 +02:00
Giuseppe Scrivano 0f9ccfe64a
chunked: remove unused argument missingDirsMode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-18 08:17:39 +02:00
Giuseppe Scrivano c85d07f33b
chunked: add new pull option use_hard_links
if the option use_hard_links is set:

[storage.options]
pull_options = {use_hard_links = "true"}

then attempt to deduplicate files using hard links first.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-18 08:17:39 +02:00
Giuseppe Scrivano a68c6e1cbf
chunked: allow to disable partial images feature
enable partial pulls only when it is explicitely configured in the
storage.conf file:

[storage.options]

pull_options = {enable_partial_images = "true"}

This is to prevent the experimental feature to leak into CRI-O.

The default value will change in future once the feature is stable.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-17 09:32:36 +02:00
Miloslav Trmač 92b63ead41 Split pkg/chunked.ZstdCompressor into a separate subpackage
containers/image/pkg/compression depends on that function, so it's
highly undesirable for it to drag in all of containers/storage.

So, move it into a separate subpackage, along with its exclusive
dependency tree.

Code that is called both from the new pkg/chunked/compressor
and the original pkg/chunked has been moved into pkg/chunked/internal ,
so that we don't expose any new public API. That move was made
purely mechanically without any concern for conceptual consistency,
to minimize the size of the dependency (and not to spend time on
that until the concept is proven to be useful).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-07-23 21:43:52 +02:00
Giuseppe Scrivano bfa0c220a5
chunked: fix the path used for layers dedup
`source` is the path to the layer that already contains the file that
is looked up.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-07-01 00:02:06 +02:00
Giuseppe Scrivano 5494513f2e
chunked: fix build on other platforms
fix package build on !linux platforms

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-05-25 14:42:28 +02:00
Giuseppe Scrivano a0ff89e09d
pkg/chunked: new zstd variant zstd:chunked
add a new custom variant of the zstd compression that permits to
retrieve each file separately.

The idea is based on CRFS and its stargz format for having seekable
and indexable tarballs.

One disadvantage of the stargz format is that a custom file is added
to the tarball to store the layer metadata, and the metadata file is
part of the image itself.  Clients that are not aware of the stargz
format will propagate the metadata file inside of the containers.

The zstd compression supports embeddeding additional data as part of
the stream that the zstd decompressor will ignore (skippable frame),
so the issue above with CRFS can be solved directly within the zstd
compression format.

Beside this minor advantage, zstd is much faster and compresses better
than gzip, so take this opportunity to push the zstd format further.

The zstd compression is supported by the OCI image specs since August
2019: https://github.com/opencontainers/image-spec/pull/788 and has
been supported by containers/image since then.

Clients that are not aware of the zstd:chunked format, won't notice
any difference when handling a blob that uses the variant.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-05-07 11:29:28 +02:00