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

KubeCluster Input sanitising #682

Open
jacobtomlinson opened this issue Mar 22, 2023 · 0 comments
Open

KubeCluster Input sanitising #682

jacobtomlinson opened this issue Mar 22, 2023 · 0 comments

Comments

@jacobtomlinson
Copy link
Member

In dask_kubernetes.operator.kubecluster we have make_cluster_spec, make_scheduler_spec and make_worker_spec. These are called by dask_kubernetes.operator.KubeCluster when creating a cluster or can be invoked directly and the output modified and passed to KubeCluster.

Today we aren't doing much in the way of input sanitisation in these functions, which means these functions can generate invalid manifests.

E.g in #665 it was raised that the cluster name can be set to a name that is invalid in Kubernetes like foo_bar which has underscores that are not allowed.

$ python -c 'from dask_kubernetes.operator import make_cluster_spec; import yaml; print(yaml.dump(make_cluster_spec(name="foo_bar")))' | kubectl apply --dry-run="server" -f -
The DaskCluster "foo_bar" is invalid: metadata.name: Invalid value: "foo_bar": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

We should do more input validation on all the arguments that can be passed to those functions to ensure they will be valid input for the Kubernetes API.

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