#field #api-version #kubernetes

kube-custom-resources-rs

Kubernetes Custom Resource Bindings

17 stable releases

2024.11.1 Nov 1, 2024
2024.9.1 Sep 1, 2024
2024.7.1 Jul 1, 2024
2024.3.1 Mar 1, 2024
2023.11.11 Nov 11, 2023

#302 in Database interfaces

Download history 135/week @ 2024-07-28 177/week @ 2024-08-04 14/week @ 2024-08-11 3/week @ 2024-08-18 21/week @ 2024-08-25 3023/week @ 2024-09-01 5691/week @ 2024-09-08 3704/week @ 2024-09-15 6948/week @ 2024-09-22 6261/week @ 2024-09-29 6921/week @ 2024-10-06 8492/week @ 2024-10-13 8775/week @ 2024-10-20 3814/week @ 2024-10-27 292/week @ 2024-11-03 105/week @ 2024-11-10

13,301 downloads per month
Used in 3 crates

0BSD license

98MB
1M SLoC

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: chaos-mesh.org/v1alpha1
kind: PodNetworkChaos
metadata:
  ...

In the above example, chaos-mesh.org is the group and v1alpha1 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 chaos_mesh_org and can be enabled like this:

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

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

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 api: Api<PodNetworkChaos> = Api::default_namespaced(client);
let resource = PodNetworkChaos::new("example", PodNetworkChaosSpec::default());
println!("doc: {:?}", issuer);

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

Dependencies

~41MB
~664K SLoC