fluvio-community / fluvio-community/k8-api

Generate rust bindings from Kubernetes openapi

Open
#4 18 comments 0 reactions 1 assignee Claimed by @vijaylaxmid View on GitHub
Dominant language
Rust
Stars
32
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Kubernetes uses OpenAPI spec: https://github.com/kubernetes/kubernetes/tree/master/api/openapi-spec to define their api.

Generate rust k8-api bindings from the spec which implements Spec trait as in the example:
```
const SERVICE_API: Crd = Crd {
group: "core",
version: "v1",
names: CrdNames {
kind: "Service",
plural: "services",
singular: "service",
},
};

#[derive(Deserialize, Serialize, Debug, PartialEq, Default, Clone)]
#[serde(rename_all = "camelCase",default)]
pub struct ServiceSpec {
#[serde(rename = "clusterIP")]
pub cluster_ip: String,
#[serde(rename = "externalIPs")]
pub external_ips: Vec,
#[serde(rename = "loadBalancerIP")]
pub load_balancer_ip: Option,
pub r#type: Option,
pub external_name: Option,
pub external_traffic_policy: Option,
pub ports: Vec,
pub selector: Option>,
}

impl Spec for ServiceSpec {

type Status = ServiceStatus;
type Header = DefaultHeader;

fn metadata() -> &'static Crd {
&SERVICE_API
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.