Commit Graph

124 Commits

Author SHA1 Message Date
Maksym Pavlenko
6f34da5f80 Cleanup logrus imports
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-05-05 11:54:14 -07:00
Iceber Gu
18d7e84f9b runtime/shim: fix the nil checkpoint options
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-04-14 22:32:50 +08:00
Iceber Gu
23d288a809 Remove the CriuPath field from runc's options
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-03-16 17:12:51 +08:00
Maksym Pavlenko
ef516a1507 Remove runtime v1
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-15 09:18:14 -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
Maksym Pavlenko
86c238c873 Generate GRPC for runtime sandbox API
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-02-02 09:58:43 -08:00
Edgar Lee
34d5878185 Use mount.Target to specify subdirectory of rootfs mount
- Add Target to mount.Mount.
- Add UnmountMounts to unmount a list of mounts in reverse order.
- Add UnmountRecursive to unmount deepest mount first for a given target, using
moby/sys/mountinfo.

Signed-off-by: Edgar Lee <edgarhinshunlee@gmail.com>
2023-01-27 09:51:58 +08:00
Maksym Pavlenko
f318e5630b Update sandbox API to return target platform
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-01-11 13:03:59 -08:00
Wei Fu
6b7e237fc7 chore: use go fix to cleanup old +build buildtag
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-12-29 14:25:14 +08:00
Maksym Pavlenko
a4d5c3e5cb Support sandboxed shims shutdown
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-12-14 18:22:52 -08:00
Maksym Pavlenko
e1abaeb386
Merge pull request #7764 from mxpv/config
Pass TOML configuration options for runtimes CRI is not aware of
2022-12-08 12:59:13 -08:00
Maksym Pavlenko
3bc8fc4d30 Cleanup build constraints
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-12-08 09:36:20 -08:00
Maksym Pavlenko
8ab1d44967 Pass runtime configuration as TOML blob
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-12-07 10:55:06 -08:00
Akihiro Suda
96a39ad53b
Merge pull request #7499 from Iceber/cleanup_shim_flag
runtime/v2/shim: clean up the use of containerdBinary
2022-11-22 22:01:23 +09:00
Kazuyoshi Kato
6596a70861 Use github.com/containerd/cgroups/v3 to remove gogo
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-11-14 21:07:48 +00:00
Shiming Zhang
c607f83c38 Fix missing closed fifo
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2022-11-04 10:13:47 +08:00
Maksym Pavlenko
b7d0d12715 Cleanup sandbox interfaces
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-10-25 12:31:32 -04:00
Kazuyoshi Kato
49a54e23cb Stats() shouldn't assume s.container is non-nil
Like other exported methods, Stats() shouldn't assume s.container is
non-nil.

Fixes #7468.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-10-12 22:11:49 +00:00
Iceber Gu
b7f6a68041 runtime/v2/shim: clean up the use of containerdBinary
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2022-10-09 18:22:48 +08:00
Brian Goff
f5fb2c32d2 Regenerate protos with updated protoc-gen-go
This fixes CI issues

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-07-28 16:59:30 +00:00
wllenyj
f710505f4a shim: fix debug flag not working
As we know, shim starts twice. The first time we execute the shim with the
`start` arguments, the `-debug` argument is passed to the shim
process correctly. But the second time we execute shim, the debug flag
is ignored.

Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
2022-05-11 22:09:12 +08:00
Kazuyoshi Kato
29b9379560 make protos
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-27 21:31:16 +00:00
Kazuyoshi Kato
fcba486366 Remove gogo from .proto files
While gogo isn't actually used, it is still referenced from .proto files
and its corresponding Go package is imported from the auto-generated
files.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-27 20:27:55 +00:00
Kazuyoshi Kato
9dbe000a38 make protos
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-22 15:31:53 +00:00
Kazuyoshi Kato
e3db7de8f5 Remove gogo/protobuf and adjust types
This commit migrates containerd/protobuf from github.com/gogo/protobuf
to google.golang.org/protobuf and adjust types. Proto-generated structs
cannot be passed as values.

Fixes #6564.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-22 15:31:53 +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
Kazuyoshi Kato
80b825ca2c Remove gogoproto.stdtime
This commit removes gogoproto.stdtime, since it is not supported by
Google's official toolchain
(see https://github.com/containerd/containerd/issues/6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-19 13:39:30 +00:00
Maksym Pavlenko
b7a36950f6 [Sandbox] Add Wait and PID
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:33:48 -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
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
Akihiro Suda
eaf7929320
Merge pull request #5738 from thaJeztah/simplify_cgroup_add
Use cgroups.AddProc() for cgroups v1
2022-03-25 10:24:43 +09: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
Sebastiaan van Stijn
c091d48cb9
Use cgroups.AddProc() for cgroups v1
All occurrences only passed a PID, so we can use this utility to make
the code more symmetrical with their cgroups v2 counterparts.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-23 15:25:09 +01:00
Sebastiaan van Stijn
d2013d2c99
runtime: deprecate runc --criu / -criu-path option
runc option --criu is now ignored (with a warning), and the option will be
removed entirely in a future release. Users who need a non- standard criu
binary should rely on the standard way of looking up binaries in $PATH.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-23 14:42:43 +01:00
Kazuyoshi Kato
067611fdea Remove enumvalue_customname, goproto_enum_prefix and enum_customname
This commit removes gogoproto.enumvalue_customname,
gogoproto.goproto_enum_prefix and gogoproto.enum_customname.

All of them make proto-generated Go code more idiomatic, but we already
don't use these enums in our external-surfacing types and they are anyway
not supported by Google's official toolchain (see #6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-03-21 19:48:16 +00:00
Kazuyoshi Kato
296f75bd07 Do not use weak import
According to https://github.com/protocolbuffers/protobuf/issues/9184

> Weak fields are an old and deprecated internal-only feature that we never
> open sourced.

This blocks us to upgrade protoc.

Fixes #6232.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-02-21 18:26:40 +00:00
Wei Fu
7901f4b331 containerd-shim-runc-v1: return init pid when clean dead shim
If containerd-shim-runc-v1 process dead abnormally, such as received
kill -s 9 signal, panic or other unkown reasons, the containerd-shim-runc-v1
server can not reap runc container and forward init process exit event.
This will lead the container leaked in dockerd. When shim dead, containerd
will clean dead shim, here read init process pid and forward exit event
with pid at the same time.

Related to: #6402

Signed-off-by: Jeff Zvier <zvier20@gmail.com>
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-02-20 15:12:50 +08:00
Fu Wei
3122239ee5
Merge pull request #6452 from zvier/main 2022-02-17 10:50:48 +08:00
Jeff Zvier
356ca75757 containerd-shim-runc-v2: return init pid when clean dead shim
If containerd-shim-runc-v2 process dead abnormally, such as received
kill 9 signal, panic or other unkown reasons, the containerd-shim-runc-v2
server can not reap runc container and forward init process exit event.
This will lead the container leaked in dockerd. When shim dead, containerd
will clean dead shim, here read init process pid and forward exit event
with pid at the same time.

Signed-off-by: Jeff Zvier <zvier20@gmail.com>
2022-01-20 17:06:55 +08:00
宁明晓10296073
b35fb7d447 remove io/ioutil
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2022-01-11 16:07:23 +08: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
Derek McGowan
f83ab813d2
Use task plugin for runc shim
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-12-13 10:37:13 -08:00
Derek McGowan
04e57d71b2
Seperate shim manager and task service
Create new shim manager interface and deprecate older
shim manager interface.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-12-13 10:37:12 -08:00
Derek McGowan
6835a94707
Split runc shim into plugin components
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-11-15 20:16:45 -08:00
Michael Crosby
e48bbe8394 add runc shim support for sched core
In linux 5.14 and hopefully some backports, core scheduling allows processes to
be co scheduled within the same domain on SMT enabled systems.

The containerd impl sets the core sched domain when launching a shim. This
allows a clean way for each shim(container/pod) to be in its own domain and any
additional containers, (v2 pods) be be launched with the same domain as well as
any exec'd process added to the container.

kernel docs: https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/core-scheduling.html

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-10-08 16:18:09 +00: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
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
Sebastiaan van Stijn
dbef1d56d7
runtime: runc v2: remove redundant validation
cgroupsv2.LoadManager() already performs VerifyGroupPath(), and returns
an error if the path is invalid, so this check is redundant.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-14 23:24:31 +02:00