MCPcopy Index your code
hub / github.com/Arnavion/k8s-openapi

github.com/Arnavion/k8s-openapi @v0.28.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.28.0 ↗ · + Follow
36,177 symbols 52,250 edges 3,639 files 39 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

This crate contains definitions of the resource types in the Kubernetes client API, auto-generated from the Kubernetes OpenAPI spec.

crates.io

Documentation

Changelog

This crate is not generated using Swagger or the OpenAPI Generator directly, as clients generated by the common client generator are. This gives this crate a few important advantages.

Works around bugs in the upstream OpenAPI spec

The upstream OpenAPI spec is not written by hand; it's itself generated from the API server's Go code. As such, the spec makes mistakes when trying to convert the representations of Go types to OpenAPI, such as incorrectly representing the JSON type used in CRD validation, and incorrectly representing the type of objects inside a WatchEvent. A client generated naively from the spec inherits all these mistakes, and it is hard for such a client to fix them in "post".

Since this crate uses a custom code generator, it is able to work around these mistakes and emit correct bindings. See the list of fixes here and the breakdown of fixes applied to each Kubernetes version here.

Supports more versions of Kubernetes

Official clients tend to support only the three latest versions of Kubernetes. This crate supports a few more.

As mentioned above, the upstream OpenAPI spec contains mistakes. When upstream fixes these mistakes, it usually does not backport them to older versions (not even to supported older versions). This crate does backport those fixes if they're applicable.

License

k8s-openapi

https://github.com/Arnavion/k8s-openapi

Copyright 2018 Arnav Singh

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

The OpenAPI spec that these bindings are generated from is sourced from the Kubernetes repository https://github.com/kubernetes/kubernetes which also uses the Apache-2.0 license.

Extension points exported contracts — how you extend this code

Resource (Interface)
A trait applied to all Kubernetes resources. [488 implementers]
src/resource.rs
DeepMerge (Interface)
A trait applies to types that support deep merging. `current.merge_from(new)` behaves in the following ways: ## `struc [3182 …
src/deep_merge.rs
Response (Interface)
(no doc) [7 implementers]
k8s-openapi-tests/src/clientset/mod.rs
RunState (Interface)
Used to create an impl of `std::io::Write` for each type that the type's generated code will be written to. [1 implementers]
k8s-openapi-codegen-common/src/lib.rs
CustomDerive (Interface)
(no doc) [1 implementers]
k8s-openapi-derive/src/lib.rs
ListableResource (Interface)
A trait applied to all Kubernetes resources that can be part of a corresponding list. [407 implementers]
src/resource.rs
AsOptVec (Interface)
(no doc) [2 implementers]
src/deep_merge.rs
MapNamespace (Interface)
A mechanism for converting (the components of) an openapi path to (the components of) a Rust namespace. The k8s-openapi
k8s-openapi-codegen-common/src/lib.rs

Core symbols most depended-on inside this repo

merge_from
called by 10537
k8s-openapi-codegen-common/templates/newtype.rs
atomic
called by 1426
src/deep_merge.rs
map
called by 384
src/deep_merge.rs
granular
called by 306
src/deep_merge.rs
deserialize
called by 98
k8s-openapi-tests/src/lib.rs
set
called by 86
src/deep_merge.rs
is_empty
called by 34
k8s-openapi-tests/src/clientset/mod.rs
get_single_value
called by 25
k8s-openapi-tests/src/lib.rs

Shape

Method 26,456
Class 6,389
Enum 3,178
Function 142
Interface 12

Languages

Rust100%

Modules by API surface

k8s-openapi-tests/src/lib.rs28 symbols
k8s-openapi-codegen-common/src/swagger20/definitions.rs20 symbols
k8s-openapi-codegen-common/src/lib.rs19 symbols
src/v1_36/apimachinery/pkg/api/resource/quantity.rs16 symbols
src/v1_35/apimachinery/pkg/api/resource/quantity.rs16 symbols
src/v1_34/apimachinery/pkg/api/resource/quantity.rs16 symbols
src/v1_33/apimachinery/pkg/api/resource/quantity.rs16 symbols
src/v1_32/apimachinery/pkg/api/resource/quantity.rs16 symbols
src/v1_36/apimachinery/pkg/util/intstr/int_or_string.rs14 symbols
src/v1_35/apimachinery/pkg/util/intstr/int_or_string.rs14 symbols
src/v1_34/apimachinery/pkg/util/intstr/int_or_string.rs14 symbols
src/v1_33/apimachinery/pkg/util/intstr/int_or_string.rs14 symbols

For agents

$ claude mcp add k8s-openapi \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact