Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anguslees/kubernetes-rs
Kubernetes API client library for Rust
https://github.com/anguslees/kubernetes-rs
Last synced: 8 days ago
JSON representation
Kubernetes API client library for Rust
- Host: GitHub
- URL: https://github.com/anguslees/kubernetes-rs
- Owner: anguslees
- License: apache-2.0
- Created: 2018-06-13T02:36:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T19:28:36.000Z (21 days ago)
- Last Synced: 2024-10-25T21:34:37.187Z (19 days ago)
- Language: Rust
- Size: 183 KB
- Stars: 67
- Watchers: 6
- Forks: 4
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A Kubernetes API client library for Rust
[crates.io]: https://crates.io/crates/kubernetes
## Status
*Experimental.*
- Get, put, list, and watch are implemented, using tokio
futures/streams.
- Client obeys `~/.kube/config` (or `$KUBECONFIG`) by default, as per
golang client. TLS is supported. Client certificates are the only
currently supported method of client authentication.
- API objects are currently manually defined and incomplete.
Additional 3rd-party object types can be defined via traits.
- API resources do not yet have a representation in Rust.
- API error handling is very naive.---
Example of listing all the pods in `kube-system` namespace.
Results are streamed, limited to 20 results per page.```rust
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::(&pods, namespace, opts)
.for_each(|pod| {
println!("pod is {}", pod.metadata.name.unwrap_or_default());
Ok(())
});core.run(work).unwrap()
}
```