#kubernetes #discovery #cloud #namespaces

cloud-discovery-kubernetes

Kubernetes implementation of rust-cloud-discovery

2 unstable releases

0.2.0 Nov 10, 2022
0.1.0 Apr 17, 2021

#31 in #k8s


Used in cluster-mode

MIT license

11KB
155 lines

Build Crates.io MIT licensed

Cloud Discovery Kubernetes

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}).

Usage

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;
    }
}

Dependencies

~63MB
~1M SLoC