paultiplady / pykube-models

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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


Languages

Language:Python 99.9%Language:Makefile 0.1%