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

[v1alpha2] Generate CRD validation in Kubernetes 1.11 #622

Closed
gaocegege opened this issue Jun 4, 2018 · 17 comments
Closed

[v1alpha2] Generate CRD validation in Kubernetes 1.11 #622

gaocegege opened this issue Jun 4, 2018 · 17 comments

Comments

@gaocegege
Copy link
Member

Ref #561 (comment)

I wrote a tool to generate the validation from the OpenAPI specification: https://github.com/gaocegege/crd-validation. Generated CRD for tfjob v1alpha2 is https://github.com/gaocegege/crd-validation/blob/master/generated/tfjob-crd-v1alpha2.yaml

While we meet an issue from Kubernetes side: kubernetes/kubernetes#59485 (comment). Kubernetes does not support addtionalproperties while it is needed for map type. Unfortunately, TFRelicaSpec is a map.

The upstream said it will be implemented in 1.11. Maybe we should wait for it. After 1.11 I think we are able to use the tool above to generate validations for all crds in kubeflow community.

@gaocegege
Copy link
Member Author

This will limit the version of Kubernetes to 1.11.

@gaocegege
Copy link
Member Author

/assign @codeflitting

@ddysher
Copy link
Member

ddysher commented Jul 2, 2018

what's the plan for crd validation, @codeflitting @gaocegege can anyone of you summarize here? are we limiting user to only use kubernetes 1.11, or we follow @jessesuen 's suggestion?

@gaocegege
Copy link
Member Author

@ddysher

We now follow jessesuen@'s suggestion to use the unstructured informer. While this is a WIP issue to use crd validation feature in Kubernetes to validate our CRD. If we do, we need to use k8s 1.11 because of kubernetes/kubernetes#59485 (comment)

@jlewi
Copy link
Contributor

jlewi commented Jul 3, 2018

Would it be possible to only enable CRD validation on K8s 1.11 and newer? So that we could continue to support older K8s? Would that be worth doing?

@gaocegege
Copy link
Member Author

I think it is not in high priority. We definitely could enable it since it just needs some config in crd yaml file.

@jlewi jlewi added this to New in 0.5.0 via automation Feb 4, 2019
@jlewi
Copy link
Contributor

jlewi commented Feb 4, 2019

@johnugeorge @richardsliu should we try to do this in 0.5?

@richardsliu
Copy link
Contributor

We should add this in 0.5.

@richardsliu richardsliu moved this from New to Multi-user kubeflow in 0.5.0 Feb 4, 2019
@richardsliu richardsliu moved this from Multi-user kubeflow to TFJob/PyTorch 1.0 in 0.5.0 Feb 4, 2019
@richardsliu
Copy link
Contributor

@gaocegege I am not sure if we can do this actually. We are adding support for multiple CRD versions (#932), and version-specific schema validation is not yet supported. ETA is k8s 1.16.

@richardsliu richardsliu removed this from TFJob/PyTorch 1.0 in 0.5.0 Mar 6, 2019
@richardsliu
Copy link
Contributor

Moving this out of 0.5.0.

@gaocegege
Copy link
Member Author

@richardsliu Now Kubebuilder could generate openAPISchema for CRD, maybe we could take a look at the implementation of kubebuilder.

@richardsliu
Copy link
Contributor

We have not decided if we are using kubebuilder yet. See discussion here: kubeflow/common#7 (comment)

@k82cn
Copy link
Collaborator

k82cn commented Apr 12, 2019

maybe we could take a look at the implementation of kubebuilder.

It's hard to import it which is binding with kubebuilder; in kube-batch/volcano, I build a shadow project to generate CRD openAPISchema and copy back to my project; and then modify it manually if necessary :)

@gaocegege
Copy link
Member Author

@richardsliu Yeah I saw the comments. We can use the function of validation generation to generate openAPISchema for all our CRDs. As for the other functions in Kubebuilder which requires re-implementation, we should discuss it carefully.

@gaocegege
Copy link
Member Author

We can run

go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go crd --output-dir ./examples/crd/

to use https://github.com/kubernetes-sigs/controller-tools generate CRD with validation for tf-operator. But the group will be tensorflow.kubeflow.org, not kubeflow.org. I think I could maintain a fork or file an PR to controller-tool to avoid tensorflow prefix then use the fork to generate the CRD from our API.

@richardsliu
Copy link
Contributor

@johnugeorge Should we fix this for v1.0?

@richardsliu richardsliu mentioned this issue Sep 4, 2019
@stale
Copy link

stale bot commented Apr 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot closed this as completed Apr 27, 2020
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

6 participants