Commit Graph

85 Commits

Author SHA1 Message Date
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
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
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
Eng Zer Jun
18ec2761c0
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-15 14:03:50 +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
haoyun
ac81297065 fix: use _ for consistency
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-12-21 14:28:47 +08:00
zounengren
1f1cad3912 io/ioutil package has been deprecated in Go 1.16 that replaces io/ioutil functions
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-10-13 09:18:31 +08:00
Derek McGowan
3f00006f72
Merge pull request from GHSA-c2h3-6mxw-7mvq
v1 & v2 runtimes: reduce permissions for bundle dir
2021-10-04 08:24:47 -07:00
Samuel Karp
6886c6a2ec
v1 runtime: reduce permissions for bundle dir
Bundle directory permissions should be 0700 by default.  On Linux with
user namespaces enabled, the remapped root also needs access to the
bundle directory.  In this case, the bundle directory is modified to
0710 and group ownership is changed to the remapped root group.

Port of the same change for the v2 runtime

Signed-off-by: Samuel Karp <skarp@amazon.com>
2021-09-22 16:13:10 -07: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
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
Phil Estes
7d4c95ff04
Merge pull request #5813 from mxpv/shim_cleanup
Cleanup v2 shim
2021-08-11 11:47:47 -04:00
Derek McGowan
0a0621bb47
Move plugin context events into separate plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-08-05 22:59:20 -07:00
Maksym Pavlenko
d30d897ef9 Cleanup v2 shim
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-08-04 10:38:05 -07:00
Shiming Zhang
fe787efa2b Fix error log when kill shim
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-03-19 19:03:47 +08:00
Derek McGowan
4a4bb851f5
Merge pull request from GHSA-36xw-fx78-c5r4
Use path based unix socket for shims
2020-11-30 10:32:18 -08:00
Samuel Karp
126b35ca43
containerd-shim: use path-based unix socket
This allows filesystem-based ACLs for configuring access to the socket
of a shim.

Ported from Michael Crosby's similar patch for v2 shims.

Signed-off-by: Samuel Karp <skarp@amazon.com>
2020-11-11 11:47:47 -08:00
Kathryn Baldauf
95ba6e9f75 Add annotations to task update request api
Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
2020-11-09 14:13:33 -08:00
Sebastiaan van Stijn
dc92ad6520
Replace errors.Cause() with errors.Is()
Dependencies may be switching to use the new `%w` formatting
option to wrap errors; switching to use `errors.Is()` makes
sure that we are still able to unwrap the error and detect the
underlying cause.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-08 14:36:45 +02:00
Wei Fu
18e581dd91 bugfix: cleanup dangling shim by brand new context
When there is timeout or cancel for create container, killShim will fail
because of canceled context. The shim will be dangling and unmanageable.

Need to use new context to do cleanup.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2020-02-21 16:49:58 +08:00
Lantao Liu
ffcb1cc9be Fix delete error code on the containerd daemon side.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-10-09 00:28:51 -07:00
Derek McGowan
0b224ac7d6
Update metadata interfaces for containers and leases
Add more thorough dirty checking across all types which
may be deleted and hold references.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-09-23 15:27:39 -07:00
Michael Crosby
eb4b3e8772 Fast path getting pid from task
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-26 17:48:00 +00:00
Akihiro Suda
fab016c7a1 runtime/v1/linux: ignore ErrCgroupDeleted in Task.Start
Fix a Rootless Docker-in-Docker issue on Fedora 30: https://github.com/docker-library/docker/pull/165#issuecomment-511717143
Related: #1598

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-07-17 12:19:15 +09:00
Michael Crosby
6601b406b7 Refactor runtime code for code sharing
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-08 11:47:53 -04:00
Michael Crosby
719a2c594e Robust pid locking for shim processes
Closes #2832

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-26 11:43:57 -04:00
Maksym Pavlenko
174c4907d0 Fix shim's file IO logging
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-06-24 13:21:41 -07:00
Michael Crosby
245052243d Add timeout for I/O waitgroups
Closes #3286

This and a combination of a couple Docker changes are needed to fully
resolve the issue on the Docker side.  However, this ensures that after
processes exit, we still leave some time for the I/O to fully flush
before closing.  Without this timeout, the delete methods would block
forever.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-20 16:13:51 -04:00
Maksym Pavlenko
fbf96d302a Fix path in LogFile creator
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-06-19 16:53:33 -07:00
Maksym Pavlenko
5e0d793801 Fix bugs in BinaryIO creator
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-06-19 11:15:17 -07:00
Maksym Pavlenko
bca5667362 Make newBinaryIO public
Allow third-party runtime implementations to reuse NewBinaryIO
in order to support pluggable shim logging binary protocol.

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-06-12 16:22:10 -07:00
Michael Crosby
42f4bb98ac
Merge pull request #3311 from jing-rui/shimlog
fix shim std logs not close after shim exit
2019-06-10 12:05:35 -04:00
Jing Rui
9e0cd529d3 fix shim std logs not close after shim exit
Signed-off-by: Jing Rui <jingrui@huawei.com>
2019-06-10 11:50:07 +08:00
Michael Crosby
7531c66d5a Ensure that the rootfs dir is created in the bundle
This fixes issues running gvisor on top of containerd without docker.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-03 19:56:19 +00:00
Danni Xia
bf24fb0cad Close file r.log after used to release resources.
Signed-off-by: Danni Xia <xiadanni1@huawei.com>
2019-06-04 06:41:38 +08:00
Derek McGowan
c9c555cd71
Merge pull request #3226 from Ace-Tang/kill_shim_in_clean
runtime-v1: kill shim in exit handler
2019-05-22 11:56:40 -07:00
Ace-Tang
5b7a327c47 Improve atomic delete
skip hidden directories in load task, and return soon if path not exist
in atomicDelete

carry of #3233

Closes #3233

Signed-off-by: Ace-Tang <aceapril@126.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-05-20 20:13:35 +00:00
Justin Terry (VM)
5e962dd8ba Remove unused Resize method from initState
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-05-13 12:35:22 -07:00
Li Yuxuan
66036d9206 v1: Respect the shim_debug flag when load tasks
Currently when we restart containerd it will load all tasks with shim
logs whether the `shim_debug` is set or not.

Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2019-05-13 23:51:16 +08:00
Michael Crosby
5cf1356c5c
Merge pull request #3255 from dvrkps/usecancel
Use cancel on errors
2019-05-07 11:40:35 -04:00
Phil Estes
836cf53e40
Merge pull request #3244 from Random-Liu/fix-container-cleanup
Return NotFound error for kill and delete in deleted state.
2019-05-07 16:49:45 +02:00
Michael Crosby
19af235051
Merge pull request #3148 from masters-of-cats/wip-rootless-containerd
Skip rootfs unmount when no mounts are provided
2019-05-07 10:39:02 -04:00
Davor Kapsa
38e3696574 Use cancel on errors
Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
2019-04-30 21:11:34 +02:00
Lantao Liu
dff7456804 Return NotFound error for kill and delete in deleted state.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-04-26 15:17:18 -07:00
Ace-Tang
dfa51c9279 runtime-v1: kill shim in cleanupAfterDeadShim
1. kill shim in cleanupAfterDeadShim avoid shim leak
2. refactor cleanupAfterDeadShim, get pid from bundle
path instead of make pid as a parameter

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-04-22 14:29:40 +08:00
Lantao Liu
9cc58781fa Check task list to avoid unnecessary cleanup.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-04-11 16:29:09 -07:00
Georgi Sabev
c0f0b21314 Apply PR feedback
* Rootfs dir is created during container creation not during bundle
  creation
* Add support for v2
* UnmountAll is a no-op when the path to unmount (i.e. the rootfs dir)
  does not exist or is invalid

Co-authored-by: Danail Branekov <danailster@gmail.com>
Signed-off-by: Georgi Sabev <georgethebeatle@gmail.com>
2019-04-04 18:40:30 +03:00
Georgi Sabev
2a5e4c4be7 Skip rootfs unmount when no mounts are provided
Co-authored-by: Julia Nedialkova <julianedialkova@hotmail.com>
Signed-off-by: Georgi Sabev <georgethebeatle@gmail.com>
2019-04-04 18:20:09 +03:00