deniz.in

Markets

Weather

Loading weather

· via dev.to (home feed)

Kubernetes Python client to move to OpenAPI Generator v7 and gain native asyncio

Google and Kubernetes contributors plan to move the official Python client off an abandoned OpenAPI Generator to v7.20+, adding native asyncio, informer-style caching and fixes for 30-second list calls.

Kubernetes Python client to move to OpenAPI Generator v7 and gain native asyncio

The official Kubernetes Python client is heading for a structural overhaul. According to a November 2026 announcement on the Google Open Source Blog, described in a dev.to write-up, Google Cloud engineers are working with open source contributors to migrate the library away from an unmaintained code generator toward OpenAPI Generator v7.20.0 and above, add native asyncio support, and bring Go-style informer caching to Python controllers. The stated driver is AI and machine learning infrastructure, where Python workloads now run on clusters far larger than the client was built for.

Generating 400,000 lines with a dead tool

Up through Kubernetes 1.35, the client produced roughly 400,000 lines of API and model code using OpenAPI Generator v4.3.0 and its python-legacy templates. That generator version was deprecated in 2020 and removed from the upstream OpenAPI Generator project in May 2022, so the client has been generating its API surface with a tool nobody maintains, while newer Python releases accumulated DeprecationWarning debt. Google says earlier migration attempts stalled on the scale of template and schema changes required across hundreds of API models, which helps explain why an abandoned generator survived this long. The new target is v7.20.0 or later, with continuous tracking of upstream generator releases built into the process. Complete feature parity with client-go is explicitly out of scope; the project frames its work around high-impact production gaps for Python developers and operators.

Three capabilities aimed at the API server relationship

Native asyncio support is the headline item. Async-first ML orchestrators, FastAPI control planes and notebooks will be able to issue concurrent, non-blocking calls through the official library, rather than choosing between the synchronous official client, a community async fork such as kubernetes-asyncio, or third-party clients like kr8s and lightkube.

The SharedInformer pattern, tracked in pull request #2515, would give Python controllers what Go controllers have had all along: a local, event-driven cache of cluster resources with list-watch behaviour, automatic reconnection, and on_add, on_update and on_delete handlers. Applications watching thousands of training pods today either hammer the API server with requests or lose their watches.

Streaming is the third item. As Kubernetes moves remote command execution away from SPDY toward WebSockets via the v5.channel.k8s.io subprotocol, the client gains WebSocket v5 channel support, tracked in pull request #2486 and KEP-4006, so exec, attach and port-forward keep working against newer control planes.

Why list calls could take 30 seconds

The performance detail that best explains user complaints: in large clusters, listing pods or nodes in Python could take more than 30 seconds, recorded in issue #1921. The cause sits in the generated model layer, which repeatedly instantiates and reconfigures schema validation objects while parsing JSON. Google says the model-initialisation revamp under the v7+ templates targets that deserialisation cost. A related limitation, the client's urllib3 transport being restricted to HTTP/1.1, so Python workloads miss the HTTP/2 multiplexing and flow control that help client-go at scale, sits outside this announcement.

Why it matters

The client is downloaded more than 73 million times a month on PyPI, roughly 1.7 million times a day, and Google positions it as second only to client-go in popularity. A library at that volume is effectively part of the platform surface, as the dev.to analysis argues, and a client built on a generator abandoned years earlier is a dependency risk platform teams should plan around rather than discover during an incident. The migration lands incrementally, so pinning a client version and reading the changelog before upgrading remains prudent. Native asyncio and SharedInformers reduce the case for community forks, which should gradually consolidate divergent async implementations, while WebSocket v5 support matters for any deployment pinned to an old version as control planes drop SPDY. The work runs in the open under SIG API Machinery, with kubernetes-client/gen as the generator repository and a bi-weekly triage meeting as the venue for raising use cases.

  • #kubernetes
  • #python
  • #openapi-generator
  • #asyncio
  • #open-source

Related posts