mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-02-21 14:34:25 +01:00
To update device resource entries from host to guest, we search for the right entry by host major:minor numbers, then later update it. However block and character devices exist in separate major:minor namespaces so we could have one block and one character device with matching major:minor and thus incorrectly update both with the details for whichever device is processed second. Add a check on device type to prevent this. Port from the Kata 1 Go agent https://github.com/kata-containers/agent/commit/27ebdc9d2761 Fixes: #703 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Kata Agent in Rust
This is a rust version of the kata-agent.
In Denver PTG, we discussed about re-writing agent in rust:
In general, we all think about re-write agent in rust to reduce the footprint of agent. Moreover, Eric mentioned the possibility to stop using gRPC, which may have some impact on footprint. We may begin to do some POC to show how much we could save by re-writing agent in rust.
After that, we drafted the initial code here, and any contributions are welcome.
Features
| Feature | Status |
|---|---|
| OCI Behaviors | |
| create/start containers | ✅ |
| signal/wait process | ✅ |
| exec/list process | ✅ |
| I/O stream | ✅ |
| Cgroups | ✅ |
Capabilities, rlimit, readonly path, masked path, users |
✅ |
container stats (stats_container) |
✅ |
| Hooks | ✅ |
| Agent Features & APIs | |
run agent as init (mount fs, udev, setup lo) |
✅ |
| block device as root device | ✅ |
| Health API | ✅ |
network, interface/routes (update_container) |
✅ |
File transfer API (copy_file) |
✅ |
Device APIs (reseed_random_device, , online_cpu_memory, mem_hotplug_probe, set_guet_data_time) |
✅ |
| VSOCK support | ✅ |
| virtio-serial support | ✖️ |
| OCI Spec validator | ✅ |
| Infrastructures | |
| Debug Console | ✅ |
| Command line | ✅ |
| Tracing | ✖️ |
Getting Started
Build from Source
The rust-agent need to be built with rust newer than 1.37, and static linked with musl.
rustup target add x86_64-unknown-linux-musl
sudo ln -s /usr/bin/g++ /bin/musl-g++
cargo build --target x86_64-unknown-linux-musl --release
Run Kata CI with rust-agent
- Firstly, install Kata as noted by "how to install Kata"
- Secondly, build your own Kata initrd/image following the steps in "how to build your own initrd/image". notes: Please use your rust agent instead of the go agent when building your initrd/image.
- Clone the Kata CI test cases from: https://github.com/kata-containers/tests.git, and then run the CRI test with:
$sudo -E PATH=$PATH -E GOPATH=$GOPATH integration/containerd/shimv2/shimv2-tests.sh
Mini Benchmark
The memory of RssAnon consumed by the go-agent and rust-agent as below:
go-agent: about 11M
rust-agent: about 1.1M