Description
The Dask operator has a number of Custom Resource Definitions. Many of these definitions have specs from other resources nested within them. For example the scheduler
and worker
parameters within DaskCluster
have nested PodSpec
specifications because these will ultimately be created as Pods by the controller.
To generate the Custom Resource Definitions that we ship in the Dask Kubernetes Operator Helm Chart we have a whole pile of yaml that contains the definition templates. Then we have a pre-commit
hook that runs k8s-crd-resolver
which renders the templates into the helm chart crds directory.
I'm conscious that k8s-crd-resolver
appears to be unmaintained and has not had new schema definitions introduced since Kubernetes 1.25
which went EOL in October 2023. I also opened elemental-lf/k8s-crd-resolver#6 over a year ago which has not had any response.
It could be interesting to explore migrating the CRD generation to Python Dataclasses instead of YAML templates. There is a library that can do this called kubecrd
but this also appears to be unmaintained. It also does not support having multiple version schemas and so would stop us from impementing #753.
As a response to this I'm exploring generating Custom Resource Definition objects in kr8s
from dataclasses (kr8s-org/kr8s#456). Putting this code in kr8s
will help ensure it is tested and maintained. It would also allow you to create multiple dataclasses, one for each version of the schema.