Commit Graph

662 Commits

Author SHA1 Message Date
Maksym Pavlenko
8dcc06d14a
Merge pull request #8747 from Iceber/shim_ttrpc_service
shim: change ttrpcService and ttrpcServerOptioner to exported interfaces
2023-07-18 17:12:22 -07:00
Akihiro Suda
98f27e1d9c
Revert "Add support for mounts on Darwin"
This reverts commit 2799b28e61.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-19 00:22:20 +09:00
Marat Radchenko
2799b28e61 Add support for mounts on Darwin
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2023-07-17 23:27:04 +03:00
Phil Estes
34b1653e95
Merge pull request #8780 from slonopotamus/uncopypaste-read-spec
Uncopypaste parsing of OCI Bundle spec file
2023-07-11 09:53:00 -04:00
Marat Radchenko
9e34b8b441 Uncopypaste parsing of OCI Bundle spec file
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2023-07-11 14:41:15 +03:00
Phil Estes
466d884518
Merge pull request #8777 from yankay/fix-restart-with-tty
Fix the automatically restart issue when using LogURI and Terminal together
2023-07-06 10:51:11 -04:00
Kay Yan
073de93086 Fix the auto restart fail when using LogURI and TTY together
Signed-off-by: Kay Yan <kay.yan@daocloud.io>
2023-07-06 04:58:56 +00:00
Iceber Gu
00e5ae2118 shim: change ttrpcService and ttrpcServerOptioner to exported interfaces
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-07-06 00:36:43 +08:00
Marat Radchenko
51a1e7f0b2 Fix example shim to actually use its task service
In commit 4b35c3829d, example shim erroneously started to depend on runc, fix that back.

Also, build example shim on all supported platforms to prevent such situations in the future.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2023-07-03 20:40:20 +03:00
Marat Radchenko
0607e73263 Move GetTopic function out of runc shim
Every shim implementation needs to select a correct publisher topic when posting events, so move it out of Linux-only runc code to the place where other shims can also use it

Otherwise, shims have to copy-paste this code. For example, see runj: 8158e558a3/containerd/shim.go (L144-L172)

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2023-06-30 10:29:21 +03:00
Jin Dong
0a92661e69 Add a platform.ParseAll helper
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2023-06-26 20:34:37 +00:00
Kazuyoshi Kato
ded713010c
Merge pull request #8617 from corhere/reduce-exec-lock-contention
runtime/v2/runc: handle early exits w/o big locks
2023-06-14 15:55:07 -07:00
Derek McGowan
0ae64ebd4e
Merge pull request #8680 from dcantah/sb-metrics
Sandbox: Add SandboxMetrics rpc
2023-06-14 18:11:18 +00:00
Jin Dong
9e09bfb590 Use RWMutex in NSMap and reduce lock area
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2023-06-14 17:50:54 +00:00
Danny Canter
d56722ef2a Sandbox: Add SandboxMetrics rpc
To gather metrics/stats about a specific sandbox instance, it'd be nice to
have a dedicated rpc for this. Due to the same "what kind of stats are going
to be returned" dilemma exists for sandboxes as well, I've re-used the metrics
type we have as the data field is just an `any`, leaving the metrics returned
entirely up to the shim author. For CRI usecases this will just be cgroup and
windows stats as that's all that's supported right now.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-06-12 03:30:48 -07:00
Derek McGowan
98b7dfb870
Merge pull request #8673 from thaJeztah/no_any
avoid "any" as variable name
2023-06-10 20:44:30 -07:00
Sebastiaan van Stijn
4bb709c018
avoid "any" as variable name
Avoid shadowing / confusion with Go's "any" built-in type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-10 13:49:06 +02: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
Cory Snider
5cd6210ad0 runtime/v2/runc: handle early exits w/o big locks
eventSendMu is causing severe lock contention when multiple processes
start and exit concurrently. Replace it with a different scheme for
maintaining causality w.r.t. start and exit events for a process which
does not rely on big locks for synchronization.

Keep track of all processes for which a Task(Exec)Start event has been
published and have not yet exited in a map, keyed by their PID.
Processing exits then is as simple as looking up which process
corresponds to the PID. If there are no started processes known with
that PID, the PID must either belong to a process which was started by
s.Start() and before the s.Start() call has added the process to the map
of running processes, or a reparented process which we don't care about.
Handle the former case by having each s.Start() call subscribe to exit
events before starting the process. It checks if the PID has exited in
the time between it starting the process and publishing the TaskStart
event, handling the exit if it has. Exit events for reparented processes
received when no s.Start() calls are in flight are immediately
discarded, and events received during an s.Start() call are discarded
when the s.Start() call returns.

Co-authored-by: Laura Brehm <laurabrehm@hey.com>
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-06-09 16:53:43 -04:00
Samuel Karp
c409c631ca
shim: WritePidFile & WriteAddress use atomicfile
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2023-06-02 16:56:34 -07:00
Akihiro Suda
2eeb4b6238
Merge pull request #8373 from Iceber/shim_run
runtime/shim: rename RunManager to Run and remove `runc/v2/services` package
2023-05-12 00:46:46 +09:00
Danny Canter
df65e321ee Simplify closing bundle dir fd
Follow-up to #8489. We don't need to call Close in the err and success
cases, we can just do it after Readdirnames returns.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-05-09 17:22:04 -07:00
Danny Canter
f5211ee3fc Change to Readdirnames for some cases
There was a couple uses of Readdir/ReadDir here where the only thing the return
value was used for was the Name of the entry. This is exactly what Readdirnames
returns, so we can avoid the overhead of making/returning a bunch of interfaces
and calling lstat everytime in the case of Readdir(-1).

https://cs.opensource.google/go/go/+/refs/tags/go1.20.4:src/os/dir_unix.go;l=114-137

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-05-08 00:41:13 -07:00
Maksym Pavlenko
6f34da5f80 Cleanup logrus imports
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-05-05 11:54:14 -07:00
Derek McGowan
7d7aac7dae
Merge pull request #8393 from Iceber/fix_checkpoint_options
runtime/shim: fix the nil checkpoint options
2023-04-24 21:22:39 -07:00
Maksym Pavlenko
370be0c18f Move logrus setup code to log package
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-04-24 10:14:13 -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
4b35c3829d update shim example
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-04-14 11:42:21 +08:00
Iceber Gu
71ababe30a runtime/shim: remove runc/v2/services
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-04-14 11:42:21 +08:00
Iceber Gu
b71f4b7518 runtime/shim: rename RunManager to Run
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-04-14 11:42:21 +08:00
Iceber Gu
f7b8b11812 update the version of the runc shim in the readme and examples
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-04-11 16:02:06 +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
Fu Wei
e735405c15
Merge pull request #7951 from Iceber/fix_restart_monitor 2023-03-16 08:58:20 +08:00
Maksym Pavlenko
07c2ae12e1 Remove v1 runctypes
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-15 09:18:16 -07: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
35a103d321
Remove "containerd.io/restart.logpath" label (deprecated since v1.5)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-03-15 09:00:11 +09:00
Iceber Gu
e0d9b96631 Fix restarting the paused containers
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-03-14 17:42:36 +08:00
Hsing-Yu (David) Chen
d602c9aec7 docs: fix typo of shim.RunManager's function comment
Signed-off-by: Hsing-Yu (David) Chen <davidhsingyuchen@gmail.com>
2023-03-06 16:29:15 -08:00
Derek McGowan
57fb2d30f0
Add max shim version environment variable
Adds environment variable to shim start command

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-03-01 11:20:49 -08:00
Derek McGowan
dba6f9db18
Add version to shim protocol
Document environment variables and test shim start response parsing.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-02-27 22:58:47 -08:00
Derek McGowan
b39239106b
Merge pull request #8134 from dcantah/docs-rtime-grpc-shims
docs: Show how to select GRPC for shims
2023-02-24 22:36:05 -08:00
Kazuyoshi Kato
a8a35cab22
Merge pull request #8142 from davidhsingyuchen/docs-logger-func
docs: add more comment to logging.LoggerFunc
2023-02-23 08:38:11 -08:00
Danny Canter
4728800abc runtime/v2: Get rid of last logrus.Fields usage
https://github.com/containerd/containerd/pull/8143 added an alias for
logrus.Fields and moved over most usages to this alias, but there was
one straggler.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-02-20 18:29:56 -08:00
Danny Canter
4278fbbc7e runtime/v2: Call onCloseWithShimLog for grpc shims
We pass in a callback using the ttrpc.WithOnClose functionality
for shims that use ttrpc, but with the newly added ability to use
GRPC for shims this was left as a follow-up. It doesn't seem like
grpc-go has anything similar so some options (that I could see) are:

This change introduces a new grpcConn wrapper type for the connection
that exposes a method to get notified when the users callback has run,
the same in functionality as TTRPC's `UserOnCloseWait`. The callback
gets passed in in a new `grpcDialContext` function that will:

1. Dial the connection as normal
2. Spin off a goroutine that will monitor the connections state
until it transitions to idle or shutdown and will then run the
callback.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-02-20 18:25:53 -08:00
Fu Wei
8cb00f45c9
Merge pull request #8143 from mxpv/log
Add Fields type alias to log package
2023-02-21 10:22:23 +08:00
Maksym Pavlenko
06e085c8b5 Add Fields type alias to log package
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-02-20 17:29:08 -08:00
Hsing-Yu (David) Chen
0ecdd341d7 docs: add more comment to logging.LoggerFunc
- When tracing code, it was a bit hard to understand what the third parameter is.
- The current comment should be enough to understand how to use LoggerFunc,
  and people who want to learn more can click into the doc link.

Signed-off-by: Hsing-Yu (David) Chen <davidhsingyuchen@gmail.com>
2023-02-20 17:22:24 -08:00
Danny Canter
ea83632a8d docs: Show how to select GRPC for shims
This updates the runtime/v2 README to state the experimental GRPC support
for shims and how to choose the protocol.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-02-18 18:05:56 -08:00
Danny Canter
979a744122 runtime/v2: Log BootstrapParams
Recent work added the ability to use grpc for shims, it'd be nice to
have a debug (or info perhaps) log to show what protocol and addr the
shim sent over.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-02-16 17:21:27 -08:00
Derek McGowan
4b80a2be96
Merge pull request #8052 from mxpv/grpc_shim
Initial GRPC shims support
2023-02-14 18:53:22 -08:00