-
Notifications
You must be signed in to change notification settings - Fork 19
Open
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<String>,
#[serde(rename = "loadBalancerIP")]
pub load_balancer_ip: Option<String>,
pub r#type: Option<LoadBalancerType>,
pub external_name: Option<String>,
pub external_traffic_policy: Option<ExternalTrafficPolicy>,
pub ports: Vec<ServicePort>,
pub selector: Option<HashMap<String, String>>,
}
impl Spec for ServiceSpec {
type Status = ServiceStatus;
type Header = DefaultHeader;
fn metadata() -> &'static Crd {
&SERVICE_API
}
Metadata
Metadata
Assignees
Labels
No labels