Crates.io | cloud-discovery-kubernetes |
lib.rs | cloud-discovery-kubernetes |
version | 0.2.0 |
source | src |
created_at | 2021-04-17 06:09:16.733724 |
updated_at | 2022-11-10 11:24:13.833438 |
description | Kubernetes implementation of rust-cloud-discovery |
homepage | |
repository | https://github.com/eipi1/cloud-discovery-kubernetes |
max_upload_size | |
id | 385612 |
size | 12,390 |
A Kubernetes implementation of rust-cloud-discovery
Returns list of instances in a kubernetes service. The crate uses kubernetes endpoint API
(/api/v1/namespaces/{namespace}/endpoints/{name}
).
use rust_cloud_discovery::{DiscoveryClient, ServiceInstance};
use cloud_discovery_kubernetes::KubernetesDiscoverService;
#[tokio::main]
async fn main() {
// initialize kubernetes client
let k8s = KubernetesDiscoverService::init("demo".to_string(), "default".to_string()).await;
if let Ok(k8s) = k8s {
let client = DiscoveryClient::new(k8s);
client.get_instances().await;
}
}