This repo contains an example how to use pydantic models as crds.
There are 2 crd model examples in the apis directory
config as v1alpha1 node as v1alpha1
The structure in this project is similar how kubebuilder is setup. Store the apis in the apis directory, structure them per group and each api version is stored in its respective version directory (in this example v1alpha1)
For each crd aka pydantic model a _types.py files is created For each version we create a exporter.py file in which you indicate the script_dir and the models you want to export
Overall there is a makefile that first exports a json schema for each model and after the generator
script picks up these exported schemas and generates a crd for each model in the crds
directory.
install the following python package in a virtual environment