7 releases (breaking)
0.6.1 | Oct 14, 2024 |
---|---|
0.6.0 | Oct 14, 2024 |
0.5.0 | Oct 13, 2024 |
0.4.0 | Oct 12, 2024 |
0.1.0 | Dec 18, 2023 |
#568 in Network programming
795 downloads per month
2MB
14K
SLoC
k8s-pb
Kubernetes protobuf bindings for kube-rs. WIP. Not yet useable as is.
Usage
This library is not currently usable from kube
.
For now consider these structs a reference location for Kubernetes structs that are not found in k8s-openapi
.
See docs.rs/k8s-pb.
Build Process
The code generation process consists of 4 steps;
just protos
- download and patch protobufsjust swagger
- download and transform openapi schemajust codegen
- combine info and build with prostjust names
- case alignment andcargo fmt
This can be run in one step with just generate
.
The k8s-pb crate is generated as a result of this process and then published periodically.
just protos
Obtains the version pinned protobufs from upstream:
- https://github.com/kubernetes/api/releases
- https://github.com/kubernetes/apimachinery/releases
- https://github.com/kubernetes/apiextensions-apiserver/releases
- https://github.com/kubernetes/kube-aggregator/releases
- https://github.com/kubernetes/metrics/releases
then does minor transforms to prepare them for building.
just swagger
Obtains the version pinned swagger openapi schema from upstream:
then applies any needed patches before transforming the schema into a shorter json file containing desired generic information.
This json file complements the protos with type type properties needed for trait implementations.
just codegen
Runs main.rs, using the outputs from the swagger
and protobuf
recipes above. In particular;
- The protos are built with prost via
protoc
and provides aFileDescriptorSet
viaConfig::file_descriptor_set_path
. - The transformed swagger result json is deserialized through lib.rs into a
HashMap<String, Resource>
where the string is a GVK string. - inject generics for each modules in hashmap via
append_trait_impl
- Generate a module tree from the seen modules in the loop
- Attach our implemented traits to the generated lib.rs