Skip to content

Latest commit

 

History

History
45 lines (37 loc) · 2.31 KB

README.md

File metadata and controls

45 lines (37 loc) · 2.31 KB

pykube-models

Pydantic models generated from the Kubernetes API, for the pykube k8s client.

Rationale

The official Python client for Kubernetes is based on the OpenAPI Client Generator. I find the auto-generated client to be quite un-ergonomic to work with, and it doesn't include any of the modern Python type-hinting features that make for easy to use IDE integrations.

Pykube provides a simple Python client with some nice Django-like utilities, which make it quite nice to work with for simple workflows. However it doesn't have any knowledge of the Kubernetes OpenAPI spec, just a few basic classes that are hand-coded like Deployment. These hand-coded classes take an obj dictionary and so there's also no type hinting.

Pydantic provides nice type-hint-enabled data models which can be generated from OpenAPI specs. It should be possible to generate a set of Pydantic models once per k8s version, and use these to render the spec dict that Pykube expects.

TODO