A crate for building custom Kubernetes kubelets.
The crate provides the [Provider] trait for declaring a Kubelet backend
as well as a the [Kubelet] type which takes a [Provider] and runs
a Kubelet server.
Example
use kubelet::{Provider, Pod, Kubelet, config::Config};
struct MyProvider;
#[async_trait::async_trait]
impl Provider for MyProvider {
const ARCH: &'static str = "my-arch";
async fn add(&self, pod: Pod) -> anyhow::Result<()> {
todo!("Implement Provider::add")
}
# async fn modify(&self, pod: Pod) -> anyhow::Result<()> { todo!() }
# async fn delete(&self, pod: Pod) -> anyhow::Result<()> { todo!() }
# async fn logs(&self, namespace: String, pod: String, container: String, sender: kubelet::LogSender) -> anyhow::Result<()> { todo!() }
}
async {
let provider = MyProvider;
let kubeconfig = kube::Config::infer().await.unwrap();
let kubelet_config = Config::default();
let kubelet = Kubelet::new(provider, kubeconfig, kubelet_config);
kubelet.start().await.unwrap();
};