kopium is a code generator that produces Rust data structures from Kubernetes custom resource definitions and their embedded OpenAPI schemas.
The tool solves the problem of manually writing type-safe Rust bindings for Kubernetes CRDs. It parses the OpenAPI schema embedded in a CustomResourceDefinition and generates corresponding Rust structs with proper field naming, documentation, and serialization attributes. The generated types can optionally implement the kube::CustomResource trait to integrate directly with the kube Rust client library, making them immediately queryable against a cluster. The generator handles case conversion to Rust conventions and extracts documentation from schema descriptions.
Teams building Kubernetes operators or controllers in Rust should adopt this tool to avoid hand-writing boilerplate bindings. It works well for projects that depend on custom resources from the broader ecosystem, since it supports reading CRDs directly from a cluster via kubeconfig or from YAML files, making it suitable for both local development and CI pipelines. The tool is compatible with nearly all catalogued CRDs and requires only Kubernetes 1.16 or later with stable CustomResourceDefinition/v1 schemas. For teams unwilling to generate code, pre-published binding libraries exist on crates.io, including a comprehensive catalogue and specific libraries for gateway-api and istio.
The project maintains active engagement with reported incompatibilities, explicitly inviting issues when a CRD does not work. Integration tests run against live clusters to verify that generated types correctly parse real CRD instances. The tool provides shell autocompletion support and includes both unit tests and file-based testing that do not require cluster access.