kopium
Kubernetes openapi unmangler.
Generates rust structs from customresourcedefinitions in your kubernetes cluster follwing the spec/status model, by using their embedded openapi schema.
⚠️ WARNING: not feature complete ⚠️
Requirements:
- stable
customresourcedefinitionwith schema - crd following standard spec/status model
Features
- Instantly queryable: generated type uses
kube-deriveto provide api integration withkube - Ergonomic Rust types: no unnecessary
Optionwrapping when#[serde(default)]onVec/BTreeMapwill suffice - Rust doc comments: optionally extracted from
descriptionvalues in schema (--docs)
Installation
Grab a prebuilt musl/darwin binary from the latest release, or install from crates.io:
Usage
Output
use CustomResource;
use ;
use BTreeMap;
/// Specification of desired alerting rule definitions for Prometheus.
/// RuleGroup is a list of sequentially evaluated recording and alerting rules. Note: PartialResponseStrategy is only used by ThanosRuler and will be ignored by Prometheus instances. Valid values for this field are 'warn' or 'abort'. More info: https://github.com/thanos-io/thanos/blob/master/docs/components/rule.md#partial-response
/// Rule describes an alerting or recording rule See Prometheus documentation: [alerting](https://www.prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) or [recording](https://www.prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules) rule
Note: Doc comments on members are also exported when they exist within the schema.
Usage with kube
Simply add the generated file (e.g. output from above in prometheusrule.rs) to your library, and import (at least) the special root type:
use PrometheusRule;
use ;
async
Testing
Generate a CRD, tell the test runner to try to use it.
License
Apache 2.0 licensed. See LICENSE for details.