Commit Graph

396 Commits

Author SHA1 Message Date
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
Sambhav Kothari
2a8dac12a7 Output a warning for label image labels instead of erroring
This change ignore errors during container runtime due to large
image labels and instead outputs warning. This is necessary as certain
image building tools like buildpacks may have large labels in the images
which need not be passed to the container.

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2021-10-14 19:25:48 +01:00
Derek McGowan
63b7e5771e
Merge pull request #5973 from Juneezee/deprecate-ioutil
refactor: move from io/ioutil to io and os package
2021-10-01 10:52:06 -07:00
jonyhy
933ddaa6f8 fix: wrong flag type
Signed-off-by: jonyhy <yun.hao@daocloud.io>
2021-09-29 16:22:51 +08:00
jonyhy
da16d492cd feat: support import image for specific platform
Signed-off-by: jonyhy <yun.hao@daocloud.io>
2021-09-29 14:00:17 +08:00
jonyhy
e6ddffc2af fix: make exec-id flag required in exec command
Signed-off-by: jonyhy <yun.hao@daocloud.io>
2021-09-28 18:19:32 +08:00
Akihiro Suda
90c6ff97a8
Merge pull request #5997 from ktock/deduped-ref
import: Add option to prevent duplicated digest image
2021-09-21 23:44:19 +09:00
Kaijie Chen
16d3f48a2e ctr namespaces: improve usage string
Signed-off-by: Kaijie Chen <chen@kaijie.org>
2021-09-21 12:26:29 +08:00
Eng Zer Jun
50da673592
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-09-21 09:50:38 +08:00
Phil Estes
f40df3d72b
Enable image config labels in ctr and CRI container creation
Signed-off-by: Phil Estes <estesp@amazon.com>
2021-09-15 15:31:19 -04:00
Kohei Tokunaga
6875aa5d37 import: Add option to skip creating digest image
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-09-15 20:20:57 +09:00
Fu Wei
d9f921e4f0
Merge pull request #5906 from thaJeztah/replace_os_exec 2021-09-11 10:38:53 +08:00
Daniel Canter
27046a9e06 Fix cwd flag for ctr tasks exec
It seems like the cwd flag isn't used anywhere for ctr tasks exec. This change
just sets the cwd field on the spec for the execed process if a new one was
asked for, otherwise it will continue using whatever was on the containers spec.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-09-02 03:59:56 -07:00
Sebastiaan van Stijn
2ac9968401
replace uses of os/exec with golang.org/x/sys/execabs
Go 1.15.7 contained a security fix for CVE-2021-3115, which allowed arbitrary
code to be executed at build time when using cgo on Windows. This issue also
affects Unix users who have “.” listed explicitly in their PATH and are running
“go get” outside of a module or with module mode disabled.

This issue is not limited to the go command itself, and can also affect binaries
that use `os.Command`, `os.LookPath`, etc.

From the related blogpost (ttps://blog.golang.org/path-security):

> Are your own programs affected?
>
> If you use exec.LookPath or exec.Command in your own programs, you only need to
> be concerned if you (or your users) run your program in a directory with untrusted
> contents. If so, then a subprocess could be started using an executable from dot
> instead of from a system directory. (Again, using an executable from dot happens
> always on Windows and only with uncommon PATH settings on Unix.)
>
> If you are concerned, then we’ve published the more restricted variant of os/exec
> as golang.org/x/sys/execabs. You can use it in your program by simply replacing

This patch replaces all uses of `os/exec` with `golang.org/x/sys/execabs`. While
some uses of `os/exec` should not be problematic (e.g. part of tests), it is
probably good to be consistent, in case code gets moved around.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-25 18:11:09 +02:00
Akihiro Suda
d3aa7ee9f0
Run go fmt with Go 1.17
The new `go fmt` adds `//go:build` lines (https://golang.org/doc/go1.17#tools).

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-08-22 09:31:50 +09:00
Michael Crosby
6f60b3016f [ctr] add HOSTNAME env for host network
Set the hostname environment var when using host networking via ctr

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-08-18 14:42:36 +00:00
Fu Wei
1c4e9d0487
Merge pull request #5846 from crosbymichael/ctr-cpu.shares 2021-08-11 09:24:00 +08:00
Michael Crosby
d2f3b71468 add cpu-shares to ctr
This allows the cpu shares to be modified via ctr.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-08-10 04:12:15 -04:00
Derek McGowan
6f027e38a8
Remove redundant build tags
Remove build tags which are already implied by the name of the file.
Ensures build tags are used consistently

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-08-05 22:27:46 -07:00