Crates.io | cri-api |
lib.rs | cri-api |
version | 0.1.4 |
source | src |
created_at | 2024-09-24 13:45:06.794577 |
updated_at | 2024-10-29 11:52:52.042809 |
description | Bindings Kubernetes CRI |
homepage | |
repository | https://gitee.com/iscas-system/cri-api |
max_upload_size | |
id | 1385258 |
size | 96,377 |
本项目基于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);
}