Commit Graph

13 Commits

Author SHA1 Message Date
Derek McGowan
c8b14ae4c0
Set content labels based on content type
Give control of the content labeling process for children to
the client. This allows the client to control the names
associated with the labels and filter out labels.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-07-21 00:46:07 -07:00
Maksym Pavlenko
8cddb5f91d Pass snapshotter opts during Pull
For remote snapshotter cases it's quite often there is need to pass extra info
from client (for instance - registry URL to query remote layer from, credentials, etc).

This commit slightly extends WithPullSnapshotter to pass extra labels to a snapshotter.

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2020-03-02 13:45:40 -08:00
Wei Fu
75af17946d Pull: create image record after blobs download
When pull image with unpack option, the fetch action will defer blobs
download until unpack. If create image record in ImageService before
blobs download, the following requests to use image will fail because
there is still missing blobs download.

In order to fix concurrent issue, need to create image record after
blobs download.

Fix: #3937

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2020-01-20 18:26:14 +08:00
Kohei Tokunaga
4ccb7aa221 Enable to propagate necessary information to snapshotter during unpack
Though containerd gives ChainID to backend snapshotters during unpack for
searching snapshots to be skipped downloading the contents, ChainID isn't enough
for some snapshotters which require additional information of layers.
Some examples are remote snapshotters which is based on stargz filesystem
(requires image-related information to query the contents to docker registry)
and those which is based on CernVM-FS (requires manifest digest, etc. for
providing squashed rootfs).

This commit solves this issue by enabling a handler to inject additional
information of layers to snapshotters during unpack.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2019-12-23 10:39:40 +09:00
Derek McGowan
30d92eff1c
Defer layer download until unpack
Moves the content fetching into the unpack process
and defers the download until the snapshot needs it
and is ready to apply. As soon as a layer is reached
which requires fetching, all remaining layers are
fetched.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-12-09 10:29:06 -08:00
Lantao Liu
c560591627 Avoid deadlock in unpacker.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-11-15 14:01:37 -08:00
Lantao Liu
555cb31fd9 Support configurable default platform in the client.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-09-03 13:34:25 -07:00
Derek McGowan
a40c3830df
Add option to pull all metadata
Add flags to pull and fetch to grab all metadata.
Add fetch option to pull only metadata.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-08-26 11:05:21 -07:00
Yu Yi
9e183f5e52
add cli option to download all manifests
- Add `all-manifests` option to both `ctr content fetch` and `ctr
  images pull`. By default it is false.
- This option ties to `AppendDistributionSourceLabel` in client.

Signed-off-by: Yu Yi <yiyu@google.com>
2019-08-23 14:02:56 -07:00
Lantao Liu
60f73b6cf1 Support simultaneous image unpack.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-08-21 16:31:29 -07:00
Michael Crosby
fe3638e887 Add UnpackOpts to RemoteContext
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-08-08 15:42:51 +00:00
Wei Fu
506b815483 remotes: add distribution labels to blob data
We can use cross repository push feature to reuse the existing blobs in
the same registry. Before make push fast, we know where the blob comes
from.

Use the `containerd.io/distribution.source. = [,]` as label format. For
example, the blob is downloaded by the docker.io/library/busybox:latest
and the label will be

    containerd.io/distribution.source.docker.io = library/busybox

If the blob is shared by different repos in the same registry, the repo
name will be appended, like:

    containerd.io/distribution.source.docker.io = library/busybox,x/y

NOTE:
1. no need to apply for legacy docker image schema1.
2. the concurrent fetch actions might miss some repo names in label, but
it is ok.
3. it is optional. no need to add label if the engine only uses images
not push.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-03-12 13:42:54 +08:00
Derek McGowan
dc09ed1e1a
Add image handler wrapper
Gives clients more control of the pull process, allowing
the client to operate on a descriptor after it has been
pulled. This could be useful for filtering output or
tracking children before they dispatched to. This can
also be used to call custom unpackers to have visibility
into a pulled config in parallel to the downloads.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-02-12 16:34:06 -08:00