Commit Graph

440 Commits

Author SHA1 Message Date
jokemanfire a345bac309 OpenOptions in blocking mod is a time-consuming operation.
1.Prevent it from blocking a tokio thread. Change sync to async.
2.Add pipe unit test which I found error in Pipe new.

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2025-01-09 02:57:43 +00:00
Phil Estes 41d2ded16a Add mod for transfer types
Makes the transfer types available in containerd_client imports

Signed-off-by: Phil Estes <estesp@amazon.com>
2025-01-08 19:50:56 +00:00
Maksym Pavlenko 95964f295e
Bump containerd client to 0.7.0
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-01-08 10:43:30 -08:00
Maksym Pavlenko ce05587af2 Update vendor
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-01-08 18:31:52 +00:00
Maksym Pavlenko bd5dd4fcbd
Remove unused fields
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-01-06 10:58:59 -08:00
jokemanfire feac9615e1 Fix publisher debug info is not correct
In the containerd log, it is not print correct
2025-01-06 10:52:50 -08:00
Maksym Pavlenko 314e384806
Fix unused fields on MacOS
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-01-06 10:50:54 -08:00
Maksym Pavlenko 346b82e673
Fix unused fields on Mac
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-12-31 15:09:58 -08:00
Maksym Pavlenko e27decc5ba
Fix clippy
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-12-31 14:33:44 -08:00
jokemanfire 4133fef4c0 Optimize: refine the scope of the lock.
We can discard the lock before reporting the incident.According to Goshim.

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-15 03:25:25 +00:00
jokemanfire a0f3bf13a1 Attemp to resolve fifo open deadlock
If long time no read side , may cause shim lock.
Avoid fifo open deadlock,use a easy timeout

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-13 20:04:38 +00:00
jokemanfire 6526c28e87 Prevent the init process from exiting and continuing with start
No need to wait for runc return an error

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-13 20:02:50 +00:00
jokemanfire eef8806871 fix process exit (not init) event not publish
1.add get id interface in process
2.add process event publish in service

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-11 20:10:31 +00:00
fengwei0328 1e17e1495e The task_dir successfully cleans when the file is absent
Signed-off-by: fengwei0328 <feng.wei8@zte.com.cn>
2024-12-06 18:54:16 +00:00
zzzzzzzzzy9 7051e312f5 if init is paused/pausing, exec state should be the same 2024-12-04 21:57:39 +00:00
ningmingxiao 8029a61a2b fix leftover shim processes 2024-12-03 23:34:03 +00:00
jokemanfire c6b623cb8b Attempt to change mutex to rwlock
In high concurrency environments, some operations are read-only and do not require mutex write locks.

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-03 23:33:04 +00:00
adsick 3044a44363 `with_namespace!`: fix formatting and accept `expr` instead of `ident` 2024-12-03 22:40:50 +00:00
Jiaxiao Zhou (Mossaka) f87972b9b0 runc/src/io: added the missing imports to unit tests
Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>
2024-12-03 17:58:52 +00:00
Jiaxiao Zhou (Mossaka) 474db59c81 runc/src/io: expose Io as a public API
Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>
2024-12-03 17:58:52 +00:00
Jiaxiao Zhou (Mossaka) b7de553f9e runc/Cargo: add the missing os_pipe dependency
Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>
2024-12-03 17:58:52 +00:00
jiaxiao zhou 7efe8d8390 runc: split Pipe, Io, and PipedIo to async and sync modules
Signed-off-by: jiaxiao zhou <duibao55328@gmail.com>
2024-12-03 17:58:52 +00:00
jokemanfire 6d496ef7fa In delete: Process not found should not return ok
Compatible with goshim

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-11-19 19:31:22 +00:00
Christos Katsakioris ac89daa9b1 snapshots: Add handy `Clone`, `Copy` derivations
Derive `Clone` for `Info`, as well as both `Clone` and `Copy` for `Kind`
and `Usage`, which allows for convenient manipulation of these types.

Signed-off-by: Christos Katsakioris <ckatsak@gmail.com>
2024-11-13 21:41:08 +00:00
jiaxiao zhou 857ace0e3f crates/runc: removed unused dep
Signed-off-by: jiaxiao zhou <duibao55328@gmail.com>
2024-11-06 18:26:42 +00:00
jiaxiao zhou a665cfcfc0 client, snapshots/Cargo.toml: Ignore `prost` in cargo-machete metadata
Signed-off-by: jiaxiao zhou <duibao55328@gmail.com>
2024-11-06 18:26:42 +00:00
Lei Liu 2689bbf250 Ignore notFound error when collect from pid cgroup
When `pids.current` or `pids.max` not exist in cgroup root
(/sys/fs/cgroup/pids/) collect_metrics will print out error level
log "...unable to read a control group file /sys/fs/cgroup/pids/./
pids.current..." continually, this commit will ignore these not
found errors.

As a supplement,if or not set pids.current file in cgroup controller
root directory decided by `CFTYPE_NOT_ON_ROOT` flag, in many commen
environment it is default to enabled. And as a contrast, go version
code will ignore all not found error when collect cgroupv1 metrics:
b67a788072/runtime/v2/runc/task/service.go (L625)

Co-authored-by: Yukiteru <wfly1998@gmail.com>

Signed-off-by: Lei Liu <liulei.pt@bytedance.com>
2024-11-05 19:33:58 +00:00
yummyMax 7c01662306 change socket path
Some containerd test use shim.SocketAddress directly.
So for Goshim-compatible socket path

Signed-off-by: yummyMax <yu.sihui@zte.com.cn>
2024-10-30 23:15:24 +00:00
jokemanfire 6cb625da04 <rshim>Improve the events report
1.add timeout in ctx
2.add queue in publisher report
3.add reconnect client method
2024-10-30 23:14:55 +00:00
zzzzzzzzzy9 792c2e619e shim: Implement the pause and resume interfaces 2024-10-30 16:53:26 +00:00
Lei Liu c22dba6201 fix: remove meaningless input from other_error macro
Signed-off-by: Lei Liu <liulei.pt@bytedance.com>
2024-10-30 00:05:16 +00:00
ningmingxiao a6b4286542 fix os_pipe doesn't work with async IO 2024-10-21 23:04:57 +00:00
Maksym Pavlenko 304d67069b Bump client to 0.6.0
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-10-07 11:35:55 -07:00
Bryant Biggs 3f541b9454 fix: All unused re-export to pass clippy 2024-10-05 14:55:48 +00:00
Bryant Biggs da4d1f48bf fix: Replace `tonic` deprecated methods to fix clippy warnings 2024-10-05 14:55:48 +00:00
Bryant Biggs ece6516da5 fix: Switch `write` to `write_all` to consume 2024-10-05 14:55:48 +00:00
Bryant Biggs 6f2812f4b8 fix: Correct lint warnings, bump toolchain version due to `cargo::key=value` build directive which is reserved for future use 2024-10-05 14:55:48 +00:00
Bryant Biggs fb4cb85d66 chore: Run `cargo fmt` 2024-10-05 14:55:48 +00:00
Bryant Biggs 2265428508 Update lib.rs
Co-authored-by: James Sturtevant <jsturtevant@gmail.com>
Signed-off-by: Bryant Biggs <bryantbiggs@gmail.com>
2024-10-05 14:55:48 +00:00
Bryant Biggs 81f51386f0 chore: Revert change to windows target 2024-10-05 14:55:48 +00:00
Bryant Biggs ece15e9275 fix: Windows client is not awaitable 2024-10-05 14:55:48 +00:00
Bryant Biggs 2050c857d6 chore: Update `tonic` and `prost` dependencies to latest 2024-10-05 14:55:48 +00:00
Maksym Pavlenko 4b8bd82ea9 Bump shim protos and fix dependencies
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-10-04 11:57:47 -07:00
Maksym Pavlenko 4e60e8a6fa Bump containerd shim to 0.7.4
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-10-04 11:30:19 -07:00
jiaxiao zhou 15f51b0899 crates/shim-protos/Cargo: relex version requirement for protobuf
Signed-off-by: jiaxiao zhou <duibao55328@gmail.com>
2024-10-04 17:40:53 +00:00
Maksym Pavlenko 202c756d26 Fix shim dependency to shim-protos and bump to 0.7.3
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-10-03 11:50:13 -07:00
Maksym Pavlenko 32f8deb6e4 Bump shim-protos to 0.7.1 and shim to 0.7.2
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-10-03 11:26:35 -07:00
Maksym Pavlenko 06156f88c8 Pin ttrpc version
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-10-03 18:11:07 +00:00
Maksym Pavlenko 6f2a8c1894 Fix crates that depend on new ttrpc
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-10-03 18:11:07 +00:00
jiaxiao zhou 217f0ee935 Cargo.toml: remove unused dependnecies
Signed-off-by: jiaxiao zhou <duibao55328@gmail.com>
2024-09-23 17:03:41 +00:00
jokemanfire 7519a0161e If parse arguments error do not panic, just exit without zero 2024-09-18 16:43:40 +00:00
zzzzzzzzzy9 71de1b435d process_info should be ProcessDetails, otherwise it can't be parsed 2024-09-03 18:21:15 +00:00
zzzzzzzzzy9 0911c1cfff When get_container return an error, just return pid=0 to connect interface 2024-08-03 02:59:27 +00:00
dependabot[bot] bd36de0f6d build(deps): update protobuf requirement from =3.1 to =3.5
Updates the requirements on [protobuf](https://github.com/stepancheg/rust-protobuf) to permit the latest version.
- [Changelog](https://github.com/stepancheg/rust-protobuf/blob/master/CHANGELOG-before-3.md)
- [Commits](https://github.com/stepancheg/rust-protobuf/compare/v3.1.0...v3.5.0)

---
updated-dependencies:
- dependency-name: protobuf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-03 02:56:05 +00:00
Bryant Biggs 3a9ceb351f chore: Update `nix` package to latest 2024-08-02 19:28:24 +00:00
zzzzzzzzzy9 288cc8082d add process info to pids() interface 2024-08-02 16:29:04 +00:00
张钰10307750 b308d13c28 add pid to delete response 2024-08-02 16:21:03 +00:00
Bryant Biggs 765111e3b1 fix: Correct clippy lint suggestion part tres 2024-07-30 16:54:34 +00:00
Bryant Biggs e771f15ce2 fix: Correct clippy lint suggestion part deux 2024-07-30 16:54:34 +00:00
Bryant Biggs 150ec63cbc fix: Correct clippy lint suggestion 2024-07-30 16:54:34 +00:00
Bryant Biggs ab17df086a chore: Fix whitespace 2024-07-30 16:54:34 +00:00
Bryant Biggs 303b2e3009 chore: Fix cargo deny failed checks and de-duplicate crates using workspace shared dependency 2024-07-30 16:54:34 +00:00
刘磊 369a73f9d9 fix: too new version protobuf break build
issue: https://github.com/containerd/rust-extensions/issues/295

Signed-off-by: 刘磊 <liulei.pt@bytedance.com>
2024-07-18 22:17:41 +00:00
Gabriel Dolberg 666a5ec112 Typos
Signed-off-by: Gabriel Dolberg <gbd199@gmail.com>
2024-06-17 20:20:51 +00:00
dependabot[bot] cecfee80b3 build(deps): update mio requirement from 0.8 to 1.0
Updates the requirements on [mio](https://github.com/tokio-rs/mio) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/compare/v0.8.0...v1.0.0)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 20:20:36 +00:00
Gabriel Dolberg 26e238edf8 Update namespace gRPC header reference path
Signed-off-by: Gabriel Dolberg <gbd199@gmail.com>
2024-06-05 21:30:12 +00:00
jingxu.zm 6b225fb414 monitor_notify_by_pid may be blocked by send msg to channel because bounded channel is full(but monitor lock has not be freed), on the other hand,monitor_unsubscribe may block because monitor lock is holded by the monitor_notify_by_pid 2024-06-05 00:35:05 +00:00
Yuhang Wei e69120e6db docs: fix broken links
Signed-off-by: Yuhang Wei <weiyuhang2011@126.com>
2024-05-29 23:33:58 +00:00
zzzzzzzzzy9 dafb1b6735 fix(overlay): If there are a large number of overlay layers, the container cannot be started 2024-05-28 22:14:28 +00:00
jiaxiao zhou 200f788a0d remove parent attribute in tracing macro
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-05-20 19:44:29 +00:00
jiaxiao zhou 1a905f4daf remove instrument proc-macro and use cfg_attr instead
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-05-20 19:44:29 +00:00
jiaxiao zhou 3688bc4a04 make clippy happy
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-05-20 19:44:29 +00:00
jiaxiao zhou cb1e5b1510 conditionally compile tracing behind a feature
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-05-20 19:44:29 +00:00
jiaxiao zhou fee0c653af add tracing macros
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-05-20 19:44:29 +00:00
fcfangcc e4558356cc add comment 2024-05-07 01:51:59 +00:00
fcfangcc 97321c7d56 fixed client if tonic has tls feature 2024-05-07 01:51:59 +00:00
dependabot[bot] 3d7180f85f build(deps): update simple_logger requirement from 4.0 to 5.0
Updates the requirements on [simple_logger](https://github.com/borntyping/rust-simple_logger) to permit the latest version.
- [Release notes](https://github.com/borntyping/rust-simple_logger/releases)
- [Commits](https://github.com/borntyping/rust-simple_logger/compare/v4.0.0...v5.0.0)

---
updated-dependencies:
- dependency-name: simple_logger
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-02 16:52:37 +00:00
Toby Lawrence dcc8e395fd Fix Clippy lint. 2024-04-26 18:30:24 +00:00
Toby Lawrence 74da0e6d59 Fix example to handle decoding event payloads with malformed type URLs. 2024-04-26 18:30:24 +00:00
Toby Lawrence 3d73fd3660 fix formatting 2024-04-26 18:30:24 +00:00
Toby Lawrence 33d4d81850 add unit test + example 2024-04-26 18:30:24 +00:00
Toby Lawrence 4a0f9292c6 Enable type names for Protocol Buffer message types to support Any decoding. 2024-04-26 18:30:24 +00:00
James Sturtevant c836f13370 Add support for windows to containerd client
Adds support to containerd client and enables running the examples

Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
2024-04-24 22:31:39 +00:00
James Sturtevant c696ce477d Release fix for cgroup parsing
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-19 21:25:23 +00:00
Jiaxiao Zhou 6b9e5b28be Update crates/shim/src/cgroup.rs
Co-authored-by: James Sturtevant <jsturtevant@gmail.com>
Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
2024-03-18 23:27:49 +00:00
jiaxiao zhou 69a7e651ea cargo clippy
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-03-18 23:27:49 +00:00
jiaxiao zhou f4753c3493 fix: make parse_cgroups_v2_path clearer
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-03-18 23:27:49 +00:00
jiaxiao zhou a5613a27df fix: more gracefully handle multiple lines in the cgroups file
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-03-18 23:27:49 +00:00
jiaxiao zhou 85a15724d0 fix(shim): rewrite cgroups v2 parsing logic
this commit rewrites the cgroups v2 parsing logic in get_cgroup function
which is used to fetch stats of a container. The reason for the rewrite
was that in some cases the original logic would panic due to index
of bound for parsing paths like

0::/kubepods-besteffort-pod162385e5_7f69_4c38_ba9c_db0a8f02b35e.slice:cri-containerd:278a0aac1fff30dfbc41b4a32ba9de4519928fe7480213dba87aa1498838ef34

we ran into this issue in deleting a spin container in the spin shim.

the rewrite replaces index access to properly propogate the error to
the caller of the function and added a few unit tests for the parsing logic.

Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2024-03-18 23:27:49 +00:00
James Sturtevant 7591cb8ee7 Mark Error for windows only
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-15 20:37:48 +00:00
James Sturtevant 31c28428d9 Run clippy and tests on sync code in containerd-shim
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-15 20:37:48 +00:00
Maksym Pavlenko 66e513a449 Fix containerd shim
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-03-14 17:32:51 +00:00
James Sturtevant 798ab74d20 Release 0.7.0 of Shim and 0.5.0 of client
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-13 19:20:17 +00:00
James Sturtevant b15a1dd0c9 Transfer ownership of FD
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-12 18:56:40 +00:00
dependabot[bot] d32d023eb3 build(deps): update command-fds requirement from 0.2.1 to 0.3.0
Updates the requirements on [command-fds](https://github.com/google/command-fds) to permit the latest version.
- [Commits](https://github.com/google/command-fds/compare/0.2.1...0.3.0)

---
updated-dependencies:
- dependency-name: command-fds
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-12 18:56:40 +00:00
James Sturtevant 9c375635b6 Remove depreciated functions
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-12 05:03:06 +00:00
Qiao 21973bd49e add oom monitor for rustshim 2024-03-06 20:29:02 +00:00
James Sturtevant 0e7760806f Use RUST_LOG env to configure logging if present
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-06 20:28:03 +00:00
Maksym Pavlenko af09869cee Patch invalid proto comments
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-22 17:49:39 +00:00
Maksym Pavlenko 1d819cc0c4 Suppress warnings for generated code
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-22 17:49:39 +00:00