3 releases
1.0.0 |
|
---|---|
0.1.4 | Oct 29, 2024 |
0.1.2 | Oct 26, 2024 |
0.1.1 | Oct 9, 2024 |
#2 in #cri
288 downloads per month
26KB
cri-api
本项目基于k8s-cri。 在此基础上,只支持v1规范,并完善examples,以方便用户开发使用。
快速开发
添加依赖
cargo add cri-api
cargo add tokio
cargo add tower
cargo add tonic
书写测试用例
use std::convert::TryFrom;
use tokio::main;
use cri_api::v1::runtime_service_client::RuntimeServiceClient;
use tokio::net::UnixStream;
use tonic::transport::{Channel, Endpoint, Uri};
use tower::service_fn;
#[tokio::main]
async fn main() {
let path = "/run/containerd/containerd.sock";
let channel = Endpoint::try_from("http://[::]")
.unwrap()
.connect_with_connector(service_fn(move |_: Uri| UnixStream::connect(path)))
.await
.expect("Could not create client.");
let mut client = RuntimeServiceClient::new(channel);
}
研制计划
Dependencies
~4–12MB
~129K SLoC