Commit Graph

414 Commits

Author SHA1 Message Date
Maksym Pavlenko
ca3b9b50fe Run gofmt 1.19
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-08-04 18:18:33 -07:00
Jonny Stoten
106433b798
Use httputil.DumpRequestOut for dumping client req
httputil.DumpRequest is only for dumping incoming requests on a server.

Signed-off-by: Jonny Stoten <jonny.stoten@docker.com>
2022-07-27 12:36:14 +01:00
Wei Fu
5f9b318e50 bin/ctr,integration: new runc-shim with failpoint
Added new runc shim binary in integration testing.

The shim is named by io.containerd.runc-fp.v1, which allows us to use
additional OCI annotation `io.containerd.runtime.v2.shim.failpoint.*` to
setup shim task API's failpoint. Since the shim can be shared with
multiple container, like what kubernetes pod does, the failpoint will be
initialized during setup the shim server. So, the following the
container's OCI failpoint's annotation will not work.

This commit also updates the ctr tool that we can use `--annotation` to
specify annotations when run container. For example:

```bash
➜  ctr run -d --runtime runc-fp.v1 \
     --annotation "io.containerd.runtime.v2.shim.failpoint.Kill=1*error(sorry)" \
     docker.io/library/alpine:latest testing sleep 1d

➜  ctr t ls
TASK       PID       STATUS
testing    147304    RUNNING

➜  ctr t kill -s SIGKILL testing
ctr: sorry: unknown

➜  ctr t kill -s SIGKILL testing

➜  sudo ctr t ls
TASK       PID       STATUS
testing    147304    STOPPED
```

The runc-fp.v1 shim is based on core runc.v2. We can use it to inject
failpoint during testing complicated or big transcation API, like
kubernetes PodRunPodsandbox.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-07-22 23:25:40 +08:00
Derek McGowan
24aad6dd46
Merge pull request #7182 from HeavenTonight/main
code cleanup
2022-07-20 13:09:10 -07:00
guiyong.ou
628f6ac681 code cleanup
Signed-off-by: guiyong.ou <guiyong.ou@daocloud.io>
2022-07-19 22:46:32 +08:00
Ye Sijun
f77d45e3ba
ctr: support --user for run/create
Signed-off-by: Ye Sijun <junnplus@gmail.com>
2022-07-12 11:53:03 +08:00
zhanghe9702
b8bb33b92d fix can't edit object by using ctr content edit command
Signed-off-by: zhang he <zhanghe9702@163.com>
2022-07-04 11:44:44 +08:00
Shiming Zhang
0a240ff811 Fix missing closed HTTP Body
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2022-06-28 14:49:27 +08:00
Kohei Tokunaga
fb5b6612a3 ctr: Fix ctr c create fails to parse arguments
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2022-06-23 21:52:53 +09:00
Justin Terry
5cde04bc7c Forward ctr snapshotter flags on Windows
Signed-off-by: Justin Terry <jlterry@amazon.com>
2022-06-21 07:54:30 -07:00
Samuel Karp
6e53ffb105
ctr: add --hostname flag to create, run
Signed-off-by: Samuel Karp <me@samuelkarp.com>
2022-06-20 15:11:44 -07:00
Derek McGowan
8ba075c3dd
Merge pull request #6954 from Iceber/fix_ctr_new_container
ctr: fix label args used in NewContainer
2022-05-25 09:01:32 -07:00
Derek McGowan
928ae45e39
Merge pull request #6959 from mythi/ctr-sb
ctr sandbox: handle sandbox config
2022-05-24 18:25:31 -07:00
Kazuyoshi Kato
868c7c3fa8
Merge pull request #6956 from my-git9/mygit2
adjust format in comment
2022-05-19 14:44:12 -07:00
Mikko Ylinen
900019b301 ctr sandbox: handle sandbox config
"ctr s r" help suggests <pod-config.json> is taken as the first
parameter and the sandbox ID becomes next. However, only the latter
is read and used.

Add code that reads <pod-config.json> and passes it to Sanbox.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2022-05-19 15:28:49 +03:00
xin.li
8ec1fc70d9 adjust format
Signed-off-by: xin.li <xin.li@daocloud.io>
2022-05-19 17:31:26 +08:00
xin.li
8494f7f117 adjust format in comment
Signed-off-by: xin.li <xin.li@daocloud.io>
2022-05-19 00:24:56 +08:00
Iceber Gu
92b7bc9edc ctr: fix label args used in NewContainer
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2022-05-18 16:11:30 +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
Phil Estes
65627f568f
Merge pull request #6809 from jterry75/main
Add ctr support for CPUMax and CPUShares
2022-04-29 16:39:52 +01:00
Mike Brown
6b35307594
Merge pull request #5490 from askervin/5Bu_blockio
Support for cgroups blockio
2022-04-29 10:07:56 -05:00
Antti Kervinen
10576c298e cri: support blockio class in pod and container annotations
This patch adds support for a container annotation and two separate
pod annotations for controlling the blockio class of containers.

The container annotation can be used by a CRI client:
  "io.kubernetes.cri.blockio-class"

Pod annotations specify the blockio class in the K8s pod spec level:
  "blockio.resources.beta.kubernetes.io/pod"
  (pod-wide default for all containers within)

  "blockio.resources.beta.kubernetes.io/container.<container_name>"
  (container-specific overrides)

Correspondingly, this patch adds support for --blockio-class and
--blockio-config-file to ctr, too.

This implementation follows the resource class annotation pattern
introduced in RDT and merged in commit 893701220.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
2022-04-29 11:44:09 +03:00
Justin Terry
227156dac6 Add ctr support for CPUMax and CPUShares
Adds CPU.Maximum and CPU.Shares support to the ctr
cmdline for testing

Signed-off-by: Justin Terry <jlterry@amazon.com>
2022-04-28 13:17:16 -07: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
Maksym Pavlenko
e2fd25f3d8 Move runtime v2 proto
Move runtime v2 protos to api/runtime package.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-19 17:59:33 -07: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
85a49e4ee7 [sandbox] Cleanup interfaces
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:34:50 -07:00
Maksym Pavlenko
0d165e6544 Restore sandboxes on daemon restart
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:33:48 -07:00
Maksym Pavlenko
17a2aaded3 [sandbox] Add ctr support
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:33:48 -07:00
Phil Estes
3633cae64b
Merge pull request #6706 from kzys/typeurl-upgrade
Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
2022-03-25 10:38:46 -04:00
Kazuyoshi Kato
96b16b447d Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
This commit upgrades github.com/containerd/typeurl to use typeurl.Any.
The interface hides gogo/protobuf/types.Any from containerd's Go client.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-03-24 20:50:07 +00:00
cosmoer
df93940fb2 fix: ctr images mount with snapshotter option can't get snapshotter
Signed-off-by: Qian Zhang <cosmoer@qq.com>
2022-03-23 23:12:54 +08:00
Michael Crosby
de9344d845
Merge pull request #6670 from snbc/ctr_run_cni
fix: `ctr run --cni` get failed
2022-03-16 14:45:00 -04:00
songjiang han
2a0b2ee9eb fix: ctr run --cni get failed
when   user  executes ctr run --cni to start a container,it will call cni plugin to create network .But when user kills it,the network won’t be removed. if we run a container with same namespace and name again will trigger a bug. we should remove the network when user kills task if it enables cni plugin.

Fix:#6604

Signed-off-by: SongJiang Han <songjiang.dark@gmail.com>
2022-03-15 15:46:29 +08:00
Kazuyoshi Kato
50ca5727b2
Merge pull request #6519 from ginglis13/ctr-runtime-path
ctr: improve error relative shim path error msg
2022-03-14 09:49:27 -07:00
Paul "TBBle" Hampson
2a425990cf Implement --device idType://id for ctr run on Windows
Also fixes the issue that `ctr run` on Windows offered help for the
non-Windows implementation, but was silently ignored.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2022-03-12 08:16:43 +11:00
Gavin Inglis
7b045ea5f0 ctr: improve error relative shim path error msg
addresses https://github.com/containerd/containerd/issues/6464

Return an error if a runtime provided is relative.

Add context to the usage for `ctr run --runtime` indicating that
absolute path to runtime binary must be provided.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
2022-03-03 23:28:03 +00:00
Justin Terry
0c79257f59 Add --user support for ctr run Windows
Adds the ability to override the default user
ContainerUser with a custom user if present in
the image or ContainerAdministrator if needed.

Signed-off-by: Justin Terry <jlterry@amazon.com>
2022-03-01 15:28:51 -08:00
Derek McGowan
62f6c8175a
Merge pull request #6424 from cpuguy83/nondist-blob-push
Add support for skipping non-dist blob push
2022-01-19 19:12:31 -08:00
ning.a.li
a303d552ad ctr: Unify the delete subcommand alias
This commit unifies the following sub commands alias for
deleting/removing.
- containers
- tasks
- contents
- leases
- images
- snapshots

Signed-off-by: Ning Li <lining2020x@163.com>
2022-01-11 16:21:26 +08:00
Brian Goff
d05194f0a7 ctr: flag to toggle non-distributable blob push
With this flag, ctr will no longer automatically push non-distributable
artifacts by default.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-01-11 00:49:40 +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
Markus Lehtonen
9e755d12e2 cmd: add --rdt-class command line option
A new option for setting the RDT class (or CLOS) from the command line.

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
2022-01-04 09:27:54 +02:00
Derek McGowan
bf60e2d174
Merge pull request #6304 from lippertmarkus/fix-ctr-cni-windows
fix(ctr): enable networking for Windows containers
2022-01-03 10:47:44 -08:00
Markus Lippert
f39b3ac7ea fix(ctr): enable networking for Windows containers
Signed-off-by: Markus Lippert <lippertmarkus@gmx.de>
2021-12-21 07:13:39 +01:00
haoyun
c0d07094be feat: Errorf usage
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-12-13 14:31:53 +08:00
Maksym Pavlenko
9e7910ebdc
Merge pull request #6271 from fuweid/move_stdout_to_stderr
ctr/snapshots/diff: show media-type in stderr
2021-11-28 11:29:21 -08:00
Wei Fu
6681cc4b94 ctr/snapshots/diff: don't show the media-type in output
By default, diff subcommand will print tar(.gz) on stdout. If we print
the media-type in stdout, the output will create invalid tar(.gz) data.

```
// before
➜  containerd git:(move_stdout_to_stderr) sudo ctr snapshot diff sha256:9f54eef412758095c8079ac465d494a2872e02e90bf1fb5f12a1641c0d1bb78b > /tmp/1.tar
➜  containerd git:(move_stdout_to_stderr) file /tmp/1.tar
/tmp/1.tar: data

// after change
➜  containerd git:(move_stdout_to_stderr) make bin/ctr
+ bin/ctr
➜  containerd git:(move_stdout_to_stderr) sudo bin/ctr snapshot diff sha256:9f54eef412758095c8079ac465d494a2872e02e90bf1fb5f12a1641c0d1bb78b > /tmp/2.tar

➜  containerd git:(move_stdout_to_stderr) file /tmp/2.tar
/tmp/2.tar: gzip compressed data, original size modulo 2^32 75155456
```

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-11-28 10:38:42 +08:00
Manabu Sugimoto
95b3ab2a4a ctr: Add Linux Capabilities control flags
This allows Linux Capabilities to be modified via `ctr`.

e.g.
```
$ sudo ./bin/ctr run --cap-add "CAP_SYS_ADMIN" --cap-drop "CAP_NET_RAW" \
--rm docker.io/library/busybox:latest foo cat /proc/self/status | grep Cap
CapInh: 00000000a82405fb
CapPrm: 00000000a82405fb
CapEff: 00000000a82405fb
CapBnd: 00000000a82405fb
CapAmb: 0000000000000000
```

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2021-11-25 14:50:43 +09:00
Claudiu Belu
5b222d54ad commands: Enables task metrics for Windows
The command already contains logic for Windows container
metrics, we just need to enable the command.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-10-05 09:25:12 -07:00