Crates.io | keel |
lib.rs | keel |
version | 0.0.1 |
source | src |
created_at | 2018-09-05 01:29:03.073919 |
updated_at | 2018-09-05 01:29:03.073919 |
description | A Kubernetes client library for Rust |
homepage | |
repository | https://github.com/aaronfriel/keel |
max_upload_size | |
id | 82986 |
size | 57,949 |
This project may be forked from the kubernetes
or it may
not.
Experimental.
~/.kube/config
(or $KUBECONFIG
) by default, as per
golang client. TLS is supported. Client certificates are the only
currently supported method of client authentication.Example of listing all the pods in kube-system
namespace.
Results are streamed, limited to 20 results per page.
extern crate kubernetes;
extern crate tokio_core;
use std::default::Default;
use tokio_core::reactor::Core;
use kubernetes::api;
use kubernetes::client::{Client,ListOptions};
use kubernetes::api::core::v1::{Pod,PodList};
fn main() {
let mut core = Core::new().unwrap();
let client = Client::new(2, &core.handle()).unwrap();
let pods = api::core::v1::GROUP_VERSION.with_resource("pods");
let namespace = Some("kube-system");
let opts = ListOptions{ limit: 20, ..Default::default() };
let work = client.iter::<PodList,Pod>(&pods, namespace, opts)
.for_each(|pod| {
println!("pod is {}", pod.metadata.name.unwrap_or_default());
Ok(())
});
core.run(work).unwrap()
}