Skip to content

Commit edb6e30

Browse files
committed
doc: Increments README
1 parent d0e97b9 commit edb6e30

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.rst

+40
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Kubedantic
2+
======================================================
3+
14
.. image:: https://img.shields.io/pypi/v/kubedantic.svg
25
:target: https://pypi.org/project/kubedantic
36

@@ -16,3 +19,40 @@
1619
1720
.. image:: https://img.shields.io/badge/skeleton-2024-informational
1821
:target: https://blog.jaraco.com/skeleton
22+
23+
24+
Generate Pydantic models from Kubernetes OpenAPI specifications.
25+
26+
Overview
27+
--------
28+
29+
Kubedantic provides a way to automatically generate Pydantic models using your Kubernetes cluster OpenAPI specifications and `datamodel-code-generator <https://github.com/koxudaxi/datamodel-code-generator>`_.
30+
31+
Usage
32+
-----
33+
34+
1. Make sure you have a Kubernetes cluster running and `kubectl` is configured to access it.
35+
2. Run `kubedantic` to generate the models.
36+
37+
.. code-block:: bash
38+
39+
$ kubedantic --output-path <destination>
40+
41+
How it works
42+
------------
43+
44+
Kubedantic does the following:
45+
46+
1. Uses the `kubernetes <https://github.com/kubernetes-client/python>`_ library to fetch the openapi specifications from the cluster.
47+
2. Merges the specifications extracted from the openapi specifications into a single schema file (one for the native types and one for the custom resources).
48+
3. Uses `datamodel-code-generator <https://github.com/koxudaxi/datamodel-code-generator>`_ to generate the Pydantic models from each schema file.
49+
50+
Schema files will be cached locally in the `kubedantic_specs/` directory, e.g.:
51+
52+
.. code-block:: bash
53+
54+
kubedantic_specs/
55+
├── k8s.json # Kubernetes native types
56+
└── crd.json # Custom resource definitions
57+
58+
You can control the cache location by using the `--specs-path` option.

0 commit comments

Comments
 (0)