blaenk / kube-custom-resources-rs

Kubernetes Custom Resource Bindings for Rust

Home Page:https://crates.io/crates/kube-custom-resources-rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kubernetes Custom Resource Bindings for Rust Chat

This repository contains kube-rs compatible bindings for Kubernetes custom resources generated with kopium

Feel free to add your own CRD to the catalog!

Installation

[dependencies]
kube-custom-resources-rs = { version = "<version>", features = ["<features>"] }

Replace <version> with the latest available release.

Features

Each group of a Kubernetes custom resource has a corresponding Cargo feature in this crate. The group of a custom resource can be seen in the apiVersion field of a resource, e.g.:

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  ...

In the above example, cert-manager.io is the group and v1 is the version. Since Cargo imposes certain rules on how features can be named, ., -, and / are all mapped to _. Therefore, the feature that contains the custom resource from the example above is called cert_manager_io and can be enabled like this:

[dependencies]
kube-custom-resources-rs = { version = "<version>", features = ["cert_manager_io"] }

Each version within a group has a corresponding module in that feature, e.g. there is a module called v1 in the feature cert_manager_io.

Take a look at the docs to see all available features and the group/version/kinds they contain.

Versioning

This crate uses a calendar based versioning scheme because resources in Kubernetes are versioned themselves.

Updates to all CRDs are fetched automatically and released on the first of each month if any changes were detected.

Usage

The generated Rust code can be used as a kube::Resource similar to this:

let issuers: Api<Issuer> = Api::default_namespaced(client);
let issuer = Issuer::new("example", IssuerSpec::default());
println!("doc: {:?}", issuer);

Take a look at the kube-rs documentation for more information.

About

Kubernetes Custom Resource Bindings for Rust

https://crates.io/crates/kube-custom-resources-rs

License:BSD Zero Clause License


Languages

Language:Rust 99.9%Language:Shell 0.1%Language:Dockerfile 0.0%