Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate CRD generation to Python dataclasses #900

Open
jacobtomlinson opened this issue Jul 31, 2024 · 0 comments
Open

Migrate CRD generation to Python dataclasses #900

jacobtomlinson opened this issue Jul 31, 2024 · 0 comments

Comments

@jacobtomlinson
Copy link
Member

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.

$ref: 'python://k8s_crd_resolver/schemata/k8s-1.21.1.json#/definitions/io.k8s.api.core.v1.PodSpec'

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant