istio-sdk

Crates.ioistio-sdk
lib.rsistio-sdk
version0.1.3
sourcesrc
created_at2023-07-21 04:30:20.855265
updated_at2023-07-24 02:23:06.552641
descriptionA collection of CRDs for api used in Istio.
homepagehttps://github.com/shenshouer/istio-sdk-rs
repositoryhttps://github.com/shenshouer/istio-sdk-rs
max_upload_size
id922078
size887,068
sope (shenshouer)

documentation

https://docs.rs/istio-sdk

README

istio-sdk-rs

A collection of CRDs used in Istio, generated by kopium directly from istio CRDs.

Quick Start

istio-sdk-rs is built on top of kube-rs as a set of CRDs, which means it can be easily used under kube_rs like below:

use istio_sdk::networking::v1beta1::destination_rule::*;
use istio_sdk::networking::v1beta1::gateway::*;
use istio_sdk::networking::v1beta1::virtual_service::*;
use kube::{
    api::{Api, ListParams},
    ResourceExt,
};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = kube::Client::try_default().await?;

    tracing_subscriber::fmt::init();

    let list_opt = ListParams::default();

    let gws: Api<Gateway> = Api::namespaced(client.clone(), "my-ns");
    for gw in gws.list(&list_opt).await? {
        println!("Found Gateway: {}", gw.name_any());
    }

    let drs: Api<DestinationRule> = Api::namespaced(client.clone(), "my-ns");
    for dr in drs.list(&list_opt).await? {
        println!("Found Destination Rule: {}", dr.name_any());
    }

    let vss: Api<VirtualService> = Api::namespaced(client.clone(), "my-ns");
    for vs in vss.list(&list_opt).await? {
        let content = serde_yaml::to_string(&vs).unwrap();
        println!("Found Virtual Service with YAML content: {}", content);
    }

    Ok(())
}

And in cargo.toml, you should specify the API version for both k8s & istio like:

[dependencies]
# ...
kube = { version = "0.84", features = ["runtime", "derive"] }
k8s-openapi = { version = "0.18", features = ["v1_18"] }
istio-sdk = { version = "0.1.0", features = ["v1_18"] }
# ...

Other

istio-sdk-rs is currently developed and tested on istio/api since v1.10, the lower api version is out of this repository's concern.

For release package, see crate.io.

Commit count: 6

cargo fmt