Commit Graph

193 Commits

Author SHA1 Message Date
Jin Dong
0a92661e69 Add a platform.ParseAll helper
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2023-06-26 20:34:37 +00:00
Jin Dong
2aeac9a8f6 Remove duplicated writeIndex func
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2023-06-22 22:48:24 +00:00
Sebastiaan van Stijn
577696f608
replace some basic uses of fmt.Sprintf()
Really tiny gains here, and doesn't significantly impact readability:

    BenchmarkSprintf
    BenchmarkSprintf-10    11528700     91.59 ns/op   32 B/op  1 allocs/op
    BenchmarkConcat
    BenchmarkConcat-10    100000000     11.76 ns/op    0 B/op  0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-10 13:24:43 +02:00
Maksym Pavlenko
07c2ae12e1 Remove v1 runctypes
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-15 09:18:16 -07:00
Akihiro Suda
b61988670c
go.mod: github.com/containerd/typeurl/v2 v2.1.0
Changes: https://github.com/containerd/typeurl/compare/7f6e6d160d67...v2.1.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-02-11 23:39:52 +09:00
David Leadbeater
31a6449734 Add capability for snapshotters to declare support for UID remapping
This allows user namespace support to progress, either by allowing
snapshotters to deal with ownership, or falling back to containerd doing
a recursive chown.

In the future, when snapshotters implement idmap mounts, they should
report the "remap-ids" capability.

Co-authored-by: Rodrigo Campos <rodrigoca@microsoft.com>
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
Signed-off-by: David Leadbeater <dgl@dgl.cx>
2022-12-21 15:08:28 -03:00
yanggang
70b65062c7
Missed out platform interface when reused the conn for Client.
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-11-19 11:01:19 +08:00
Danny Canter
0be981595d Sandbox API: Move remote impls to /sandbox/proxy
Following how some of the other stores/services are returned in the
client package, it makes sense to me to move the remoteFooBars in
the sandbox API to a proxy sub-package under /sandbox. Given this
has only been in a 1.7 beta, I hope this is fine to move around still.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2022-10-28 14:47:09 -07:00
lengrongfu
5e57d463df feature: use client default namespace
Signed-off-by: rongfu.leng <1275177125@qq.com>
2022-09-06 22:18:28 +08:00
Akihiro Suda
42584167b7
Officially deprecate Schema 1
Schema 1 has been substantially deprecated since circa. 2017 in favor of Schema 2 introduced in Docker 1.10 (Feb 2016)
and its successor OCI Image Spec v1, but we have not officially deprecated Schema 1.

One of the reasons was that Quay did not support Schema 2 so far, but it is reported that Quay has been
supporting Schema 2 since Feb 2020 (moby/buildkit issue 409).

This PR deprecates pulling Schema 1 images but the feature will not be removed before containerd 2.0.
Pushing Schema 1 images was never implemented in containerd (and its consumers such as BuildKit).

Docker/Moby already disabled pushing Schema 1 images in Docker 20.10 (moby/moby PR 41295),
but Docker/Moby has not yet disabled pulling Schema 1 as containerd has not yet deprecated Schema 1.
(See the comments in moby/moby PR 42300.)
Docker/Moby is expected to disable pulling Schema 1 images in future after this deprecation.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-05-02 19:08:38 +09:00
Kazuyoshi Kato
237ef0de9b Remove all gogoproto extensions
This commit removes the following gogoproto extensions;

- gogoproto.nullable
- gogoproto.customename
- gogoproto.unmarshaller_all
- gogoproto.stringer_all
- gogoproto.sizer_all
- gogoproto.marshaler_all
- gogoproto.goproto_unregonized_all
- gogoproto.goproto_stringer_all
- gogoproto.goproto_getters_all

None of them are supported by Google's toolchain (see #6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-20 07:23:28 +00:00
Kazuyoshi Kato
88c0c7201e Consolidate gogo/protobuf dependencies under our own protobuf package
This would make gogo/protobuf migration easier.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-19 15:53:36 +00:00
Maksym Pavlenko
eaccbf1d03 [sandbox] Add clients
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:33:47 -07:00
Brian Goff
d5e8edf2df Do not automatically inject client traces
This is a effective revert of 294143bf38
The one thing that makes it not a total revert is this keeps the usage
of chain interceptors, which prevents us from overwriting interceptors
passed into client options.

The automatic trace injection is unnecessary overhead since callers of
this function can add the necessary interceptors when creating the
client.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-01-13 22:11:18 +00:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
Kazuyoshi Kato
2ee3ce510c Use insecure.NewCredentials instead of grpc.WithInsecure
grpc.WithInsecure is being deprecated.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-12-16 23:10:06 +00:00
haoyun
f8d734e406 fix: make max recv/send msg size setting default
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-11-18 09:54:31 +08:00
haoyun
547040cd5b feat:support custom callopts on client side
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-11-16 11:31:33 +08:00
Brian Goff
294143bf38 Inject otel traces to grpc client.
This uses the global trace provider.
If a trace provider is not set, a no-op provider is used.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-10-21 16:08:15 +00:00
Rui Lopes
072a7074b4 Fix typo in the NewContainer function documentation
Signed-off-by: Rui Lopes <rgl@ruilopes.com>
2021-10-10 19:46:55 +01:00
zounengren
789abc9367 using Hosts replace deprecated field
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-05 11:52:46 +08:00
Kazuyoshi Kato
73d28ddeb2 client: surface a connection error more clearly
gRPC-Go recently added grpc.WithReturnConnectionError() which improves
the situation of #2576.

Permission errors:

  % ./bin/ctr t ls
  ctr: failed to dial "/run/containerd/containerd.sock": connection error: desc = "transport: error while dialing: dial unix /run/containerd/containerd.sock: connect: permission denied"
  %

Non-existent sockets:

  % ./bin/ctr -a notfound t ls
  ctr: failed to dial "notfound": context deadline exceeded: connection error: desc = "transport: error while dialing: dial unix://notfound: timeout"
  %

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-07-02 14:56:04 -07:00
Wei Fu
f8c2f04756 remotes/ctr: allow to limit max concurrent uploads like downloads
Also add flags for push/pull subcommand to limit max concurrent
uploads/downloads.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-03-25 14:37:02 +08:00
Derek McGowan
35eeb24a17
Fix exported comments enforcer in CI
Add comments where missing and fix incorrect comments

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-03-12 08:47:05 -08:00
Davanum Srinivas
b446ed1ca8
Document the Runtime public method
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-03-12 10:29:04 -05:00
Davanum Srinivas
6a4aa1e2e7
Separate go module for client tests
Will help us drop dependency to github.com/Microsoft/hcsshim/test in the
main go.mod

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-03-11 19:27:45 -05:00
Kathryn Baldauf
f8992f451c add optional check that snapshotter supports the image platform when unpacking
Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
2020-12-10 10:54:22 -08:00
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
ktock
03ab1b2cac Add config for allowing GC to clean unpacked layers up
This commit adds a flag through Pull API for allowing GC to clean layer contents
up after unpacking these contents completed.

This patch takes an approach to directly delete GC labels pointing to layers
from the manifest blob. This will result in other snapshotters cannot reuse
these contents on the next pull. But this patch mainly focuses on CRI use-cases
where single snapshotter is usually used throughout the node lifecycle so this
shouldn't be a matter.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2020-06-21 11:16:53 +09:00
Tobias Klauser
a9bd451ab4 Avoid duplicate imports of github.com/gogo/protobuf/types
Re-use the import aliased as `ptypes`.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-03-10 09:41:03 +01: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
Akihiro Suda
8e448bb279 vendor protobuf & grpc
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-02-26 10:57:05 +09: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
Kathryn Baldauf
a18f77bea0 create local version of introspection service
Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
2020-01-02 12:34:23 -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
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
Lantao Liu
af7b7cdb02 Save default namespace in the client.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-08-07 12:03:22 -07:00
Michael Crosby
9f0bc2b53f Add UUID and server info to introspection
Closes #1862

This adds a new rpc to the introspection service to provide server
information with a generated UUID that is done on demand and the os and
arch of the server.

ctr output:

```bash
> sudo ctr version

Client:
  Version:  v1.2.0-802-g57821695.m
  Revision: 578216950de9c1c188708369e2a31ac6c494dfee.m

Server:
  Version:  v1.2.0-802-g57821695.m
  Revision: 578216950de9c1c188708369e2a31ac6c494dfee.m
  UUID: 92e982a9-f13e-4a2c-9032-e69b27fed454
  OS: linux
  ARCH: amd64
```

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-08-06 14:40:48 +00:00
Derek McGowan
c965a6c4da
Prevent push by tag for sub-manifests
When pushing a manifest list, all manifests should be pushed by digest
and only the final manifest pushed by tag. The Pusher was preventing
this by mistakenly disallowing objects to contain a digest. When objects
have a digest, only push tags associated with that digest.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-07-31 15:19:44 -07:00
Michael Crosby
f055bdb0aa Remove windows v1 runtime
Closes #3094

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-23 18:54:37 +00:00
Wei Fu
283d5d9005
Merge pull request #3418 from stevvooe/backout-error-changes
errors: use errdefs errors in client and commands
2019-07-17 21:32:52 -04:00
Stephen Day
804ae89be6
errors: use errdefs errors in client and commands
This change moves from specific, global errors to the errdefs errors.
This makes it easy to handle certain classes of errors while still
adding context to the failure.

Signed-off-by: Stephen Day <stephen.day@getcruise.com>
2019-07-17 13:42:28 -07:00
Michael Crosby
ce0d2489ac Fix regiression from #3403 with snapshot cmd
The snapshot command calls the snapshotter service directly, therefore,
the name must be resolved.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-16 19:24:24 +00:00
Michael Crosby
61d930ad5b Move specific errors to their respective packages
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-15 20:21:11 +00:00
Fahed Dorgaa
db95af43f3 centralize harded-code message
Signed-off-by: Fahed Dorgaa <fahed.dorgaa@gmail.com>
2019-07-13 15:07:23 +02:00
Maksym Pavlenko
550a6f1d73 Fix integration tests
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-07-11 11:54:48 -07:00
Maksym Pavlenko
1918ee4d11 Respect default snapshotter label
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-07-10 12:16:43 -07:00
Maksym Pavlenko
47d2ac0902 Improve default label handling
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-07-10 12:15:08 -07:00