Commit Graph

96 Commits

Author SHA1 Message Date
Maksym Pavlenko 559bf7bc8d Bump shim-protos to 0.1.2
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-30 09:14:03 +02:00
Maksym Pavlenko 4ad21f61b3 [shim-protos] Update README
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-30 09:12:54 +02:00
Maksym Pavlenko 39065ec9ed Rename shim-client to shim-protos
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-30 08:43:32 +02:00
Maksym Pavlenko 3ae0f183c3
Fix links to docs 2021-12-28 11:10:42 +02:00
Maksym Pavlenko d901356551 Update dependencies
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-28 10:54:59 +02:00
Maksym Pavlenko e4e89033bb
Update README.md 2021-12-28 10:50:18 +02:00
bin liu cfca48d75c containerd-client: add example to create container and task
Add an example to show how to create/delete containers and tasks.

Signed-off-by: bin liu <bin@hyper.sh>
2021-12-19 20:09:17 -08:00
bin liu 2010a32a47 containerd-client: add task service and with_namespace macro
There is no task service included yet, add the task
service protocol file to build.rs.

Add a with_namespace maro to let user inject namespace

Signed-off-by: bin liu <bin@hyper.sh>
2021-12-19 20:09:17 -08:00
Maksym Pavlenko fcb5cc5966 Update crate description
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-18 10:39:28 -08:00
Maksym Pavlenko a6b32c32bd Add README
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-18 10:39:28 -08:00
Maksym Pavlenko e5d003c8bb Add snapshots example
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-18 10:39:28 -08:00
Maksym Pavlenko 70f7cacdc1 Implement GRPC wrapper for snapshots
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-18 10:39:28 -08:00
Maksym Pavlenko e3b7f97813 Generate GRPC bindings for snapshots
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-18 10:39:28 -08:00
Maksym Pavlenko b342a674b1 Add snapshots crate
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-18 10:39:28 -08:00
Maksym Pavlenko 2e501d2892
Merge pull request #10 from mxpv/deny
Add cargo deny
2021-12-15 21:28:00 -08:00
Maksym Pavlenko b7e673d7a7 Add cargo deny
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-15 20:58:32 -08:00
Maksym Pavlenko cd185c1c6a
Merge pull request #9 from jiangliu/shim-new
shim: distinguish between runtime id and container id
2021-12-13 21:51:46 -08:00
Liu Jiang 95e8049398 shim: distinguish between runtime id and container id
There's a misuse of runtime id and container id in Shim::new(). Both
runtime id and container id are needed by shim implentions, so add
parameter `container id` to Shim::new().

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-14 13:44:45 +08:00
Maksym Pavlenko 712d355fd9
Merge pull request #7 from liubin/fix/liubin-1213
Update shim/README.md for running examples locally
2021-12-13 20:51:53 -08:00
bin liu c12ac9ee68 shim: update README.md to run shim examples
The content of README.md is out of date, update it
with the correct steps to run the examples.

Signed-off-by: bin liu <bin@hyper.sh>
2021-12-14 11:37:00 +08:00
bin liu bcf427ab94 shim: add log to .gitignore
add log to .gitignore to avoid committing log file to repo.

Signed-off-by: bin liu <bin@hyper.sh>
2021-12-13 18:15:17 +08:00
bin liu e5e0ebbe36 shim: pass the correct ID of containers to shim
The ID passed from shim::run::<Service> is the shim name,
the container ID can get from command-line flags.

Signed-off-by: bin liu <bin@hyper.sh>
2021-12-13 18:14:51 +08:00
Maksym Pavlenko 4f75160aef
Merge pull request #5 from jiangliu/shim
[RFC] Bugfix and enhancements for crate containerd-shim
2021-12-12 21:28:34 -08:00
Liu Jiang 72aebb1b39 shim: trivial documentation enhancements
Trivial documentation enhancements:
1) comments for unsafe code
2) list supported platforms

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:13:05 +08:00
Liu Jiang a2bfeed2ca shim: introduce Shim::wait()
Introduce Shim::wait() to wait for a shim instance to exit, so the
`Shim` implementor could customize the way to manage exit event.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:20 +08:00
Liu Jiang fdd50661f3 shim: add interface Shim::get_task_service()
Currently Containerd shimv2 runtime only provides task service, but it
may provide more service in future. So add interface
Shim::get_task_service() to get the task service object instead of
"Shim: Task".

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:19 +08:00
Liu Jiang 7a8fa4413e shim: implement ExitSignal with Condvar
Implement ExitSignal with Condvar instead of busy looping.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:15 +08:00
Liu Jiang 04af4df73a shim: pass environment variables to spawned process
Enhanace spawn() to pass envrionment variables to child process.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:15 +08:00
Liu Jiang 1b106ee38d shim: add unit test for start_listener()
Add unit test for start_listener().

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:14 +08:00
Liu Jiang 0c83d7c04c shim: be more careful when removing stale socket files
The function start_listener() tries to remove stale socket files when
syscall::bind() retune EADDRINUSE, let's be more careful to only remove
existing sockets instead of other types of files.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:13 +08:00
Liu Jiang 63f62b9c9c shim: avoid raw fd leak in spawn()
The RawFd for the listener socket will get leaked in error handling
path in start_listener(). Use UnixListener to replace RawFd for clear
ownership and also simplify the code a bit.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:12 +08:00
Liu Jiang 64d57879ce shim: add unit tests for remote publisher
Add unit tests for remote publisher.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:11 +08:00
Liu Jiang 01e45800dc shim: release fd when error happens in RemotePublisher::connect()
A RawFd won't be automatically released when going out of scope,
so we need to close the just created RawFd when error happens
in RemotePublisher::connect().

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:11 +08:00
Liu Jiang 0eff017c40 shim: add unit test case for logger
Add unit test case for logger.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:10 +08:00
Liu Jiang 5197e72f4a shim: do not panic if failed to log to FIFO
According to Linux FIFO doc, writing to a FIFO without reader may
return errors:
If all file descriptors referring to the read end of a pipe have been
closed, then a write(2) will cause a SIGPIPE signal to be generated
for the calling process. If the calling process is ignoring this
signal, then write(2) fails with the error EPIPE.

When restarting logger servers, there are small race windows that
FifoLogger::log/flush() may encounter IO error and panic. It's not
a good situation to panic due to errors in logging subsystem.

So just ignore those IO errors.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:09 +08:00
Maksym Pavlenko 2ad939e3fa
Merge pull request #3 from jiangliu/shim-proto
Consolidate shim-proto from Alibaba runD into shim-client
2021-12-12 10:06:01 -08:00
Liu Jiang 4f78733008 shim-client: refine data structures exported by submodule api
Reexport auto-generated public data structures under submodule api.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-12 22:39:33 +08:00
Liu Jiang 6d46508d3b shim-client: add unit test cases and more examples
Add unit test cases and more examples.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-12 22:39:32 +08:00
Liu Jiang 62fd081d88 shim-client: add support for cgroup metrics
Generate rust bindings for cgroups metrics from protobuf file:
https://github.com/containerd/cgroups/blob/main/stats/v1/metrics.proto

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-12 22:39:31 +08:00
Liu Jiang 8655b0ff41 shim-client: make dependency on ttrpc-codegen as optional
Now we have feature "generate_bindings" for shim-client, and crate
ttrpc-codegen is used only when feature "generate_bindings" is enabled.
So mark ttrpc-codegen as optional.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-12 22:39:30 +08:00
Liu Jiang 9d66917ce1 shim-client: docuement the way to upgrade the auto-generated code
Enhance README.md to document the way to upgrade the auto-generated
rust source code.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-11 15:20:53 +08:00
Maksym Pavlenko b8252e525b Bump containerd client to 0.1.2
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 16:01:05 -08:00
Maksym Pavlenko 8cf673677a Update containerd client dependencies
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:58:05 -08:00
Maksym Pavlenko 9560f5c721 Add dependencies status badge
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:50:00 -08:00
Maksym Pavlenko e77d553367 Add links to docs
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:41:06 -08:00
Maksym Pavlenko 34ab8a1b6f Bump version to 0.1.1
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:33:15 -08:00
Maksym Pavlenko 064387518e Update authors and homepage
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:32:26 -08:00
Maksym Pavlenko 3baf235798 Include generated code for shim-client
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:25:47 -08:00
Maksym Pavlenko 97ae630389 Fix build
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:18:15 -08:00
Maksym Pavlenko 87f97f462c Add copyright headers
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:14:48 -08:00