Expand description
§engenho-kube-codegen
Reads vendored Kubernetes OpenAPI v3 JSON + emits typed Rust source
into engenho-types/src/generated_v1_34/. The
load-bearing invariant: no hand-authored K8s resource
types — every kind is generated bit-reproducibly from upstream.
§What’s generated today (M0.0.1 first pass)
A “thin kind” representation: each generated struct carries:
metadata: engenho_types::meta::ObjectMetaspec: serde_json::Value(typed expansion is M0.0.4)status: Option<serde_json::Value>
Plus a KubeResource impl with the correct
GroupVersionKind / GroupVersionResource / Scope.
§Future (M0.0.4)
Recursive $ref expansion through the OpenAPI spec produces
fully-typed PodSpec, Container, Volume, etc. Hand-rolled
ObjectMeta also becomes generator output at that point.
§Determinism contract
kube-codegen --check (callable from CI) must regenerate
byte-identical source from the same input. Implementation:
- Sort iteration deterministic (
BTreeMap, neverHashMap). - Emitted source has a fixed header comment.
- Field ordering: required-then-optional, then alphabetical.
Re-exports§
pub use catalog::KIND_CATALOG;pub use catalog::KindEntry;pub use catalog::Subresource;pub use emit::emit_catalog;pub use emit::emit_kind;pub use emit::emit_kind_typed;pub use emit::emit_module;pub use emit_blue::emit_blue_kinds;pub use emit_typed::SchemaView;pub use openapi::KindShape;pub use openapi::OpenApiDoc;
Modules§
- catalog
- Curated catalog of K8s kinds to generate in the M0.0.1 first pass.
- emit
- Source emitters — typed config → Rust source string.
- emit_
blue - emit_
typed - Typed-struct emission engine (M0.0.4 brick 2).
- openapi
OpenAPIv3 parser — sufficient surface to extract a “kind shape” percrate::catalog::KindEntry.- schemas
- types
OpenAPIv3 schema → Rust type mapping (the M0.0.4 typed-emission core).
Functions§
- format_
source - Format emitted Rust source, deterministically and without a subprocess.