The canonical location of the Kubernetes API definition.
Go to file
Kubernetes Publisher 863819f1e8 Merge pull request #134156 from JoelSpeed/enable-ssa-tags
Enable SSATags linter to enforce +listType on lists in APIs

Kubernetes-commit: 1aec2eb0030d2f121b4cf78998e9391d9389f1a0
2025-09-22 19:23:00 +00:00
.github
admission Enable SSATags linter to enforce +listType on lists in APIs 2025-08-19 14:19:24 +01:00
admissionregistration
apidiscovery
apiserverinternal/v1alpha1
apps
authentication
authorization
autoscaling
batch
certificates Enable SSATags linter to enforce +listType on lists in APIs 2025-08-19 14:19:24 +01:00
coordination
core/v1
discovery
events
extensions
flowcontrol
imagepolicy
networking
node
policy
rbac
resource
scheduling
storage
storagemigration/v1alpha1
testdata
CONTRIBUTING.md
LICENSE
OWNERS add go.work.sum to dep-approvers file list 2025-09-17 14:05:49 -07:00
README.md
SECURITY_CONTACTS
code-of-conduct.md
doc.go
go.mod Merge pull request #134145 from dims/update-to-latest-sigs.k8s.io/json 2025-09-19 03:23:00 +00:00
go.sum Merge pull request #134145 from dims/update-to-latest-sigs.k8s.io/json 2025-09-19 03:23:00 +00:00
openapi_models_test.go
roundtrip_test.go

README.md

⚠️ This is an automatically published staged repository for Kubernetes.
Contributions, including issues and pull requests, should be made to the main Kubernetes repository: https://github.com/kubernetes/kubernetes.
This repository is read-only for importing, and not used for direct contributions.
See CONTRIBUTING.md for more details.

api

Schema of the external API types that are served by the Kubernetes API server.

Purpose

This library is the canonical location of the Kubernetes API definition. Most likely interaction with this repository is as a dependency of client-go.

It is published separately to avoid diamond dependency problems for users who depend on more than one of k8s.io/client-go, k8s.io/apimachinery, k8s.io/apiserver...

We recommend using the go types in this repo. You may serialize them directly to JSON.

If you want to store or interact with proto-formatted Kubernetes API objects, we recommend using the "official" serialization stack in k8s.io/apimachinery. Directly serializing these types to proto will not result in data that matches the wire format or is compatible with other kubernetes ecosystem tools. The reason is that the wire format includes a magic prefix and an envelope proto. Please see: https://kubernetes.io/docs/reference/using-api/api-concepts/#protobuf-encoding

For the same reason, we do not recommend embedding these proto objects within your own proto definitions. It is better to store Kubernetes objects as byte arrays, in the wire format, which is self-describing. This permits you to use either JSON or binary (proto) wire formats without code changes. It will be difficult for you to operate on both Custom Resources and built-in types otherwise.

Compatibility

Branches track Kubernetes branches and are compatible with that repo.

Where does it come from?

api is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api. Code changes are made in that location, merged into k8s.io/kubernetes and later synced here.

Things you should NOT do

  1. https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api is synced to k8s.io/api. All changes must be made in the former. The latter is read-only.