-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support generating CRDs with logical constraints using [ "oneOf", "allOf", "anyOf", "not" ] #6801
Comments
Stepping by to say that this is going to be a pretty massive amount of work, and support of the constructs is going to have nuances. I have been involved in (part of) it with the Kiota project, and this compatibility matrix is part of the end result. I encourage anyone that want to look into this to start with a detailed proposal of the mappings that should be supported. |
@andreaTP Thank you for your response!
I agree, just trying to describe a desired solution when creating this issue seemed non-trivial!
If I understand correctly kubernetes restricts the use of these logical constraints. As a result, I think only "peer properties" from the compatibility matrix (not "inline schemas" or "referenced schemas") are possible in CRD schemas. According to this blog post: https://kubernetes.io/blog/2019/06/20/crd-structural-schema/
I don't have a detailed proposal, but I agree with you that this is the right place to start. |
I have the same opinion, this won't be an easy task and also needs some refactoring first. But as mentioned by @matteriben it's important to know that we don't have to implement it fully. We can focus on those parts which are supported by Kubernetes. The low level approach with Jackson in v2 might be helpful here. It might be also good to collect and look first into existing implementations. victools/jsonschema-generator supports Does someone know other Java jsonschema generators based on Jackson? I did last year an experiment and implemented a CRD-Generator based on victools/jsonschema-generator: https://github.com/baloo42/crd-generator-victools An example using We should also talk about which additional annotations would be required and which from Jackson itself can be reused. @matteriben Do you already have other additional or existing annotations in mind? |
@baloo42 I'm sorry, but I do not. |
Is your enhancement related to a problem? Please describe
I would like to be able to generate a CRD that includes logical constraints using [ "oneOf", "allOf", "anyOf", "not" ].
For example:
Describe the solution you'd like
Express these constrains for the CRD generator using java annotations?
For example something like:
Describe alternatives you've considered
Perhaps these constraints could possibly be expressed through OOP?
For example something like:
Additional context
https://kubernetes.io/blog/2019/06/20/crd-structural-schema/
The text was updated successfully, but these errors were encountered: