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

recursive schemas not supported #18

Open
alexzielenski opened this issue May 4, 2023 · 6 comments
Open

recursive schemas not supported #18

alexzielenski opened this issue May 4, 2023 · 6 comments
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.

Comments

@alexzielenski
Copy link
Contributor

alexzielenski commented May 4, 2023

The schema validator used by Kubernetes server and kubectl-validate does not support recursively defined schemas. This can be fixed but it would be a fairly big modification.

CRDs cannot be recursive, so this is not a concern for them.
There may be some native types that have a recursive schema. One example of this is CustomResourceDefinition itself. n this single case, we workaround this by using the handwritten validation code for CRDs since they are so common.

In general, we should detect and block validation of recursive schemas.

@alexzielenski alexzielenski added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label May 5, 2023
@swastik959
Copy link
Contributor

hi @alexzielenski I want to work on this issue and wanted to know if we need to block the validation of the resources against recursive schema or do we need to block the validation of the schema itself

@alexzielenski
Copy link
Contributor Author

We would want to block validation of resources against a recursive schema. I think the tool should show a warning rather than fail the entire operation

@swastik959
Copy link
Contributor

@alexzielenski if I am not wrong the schema to recursive it should have a $ref right ?

@alexzielenski
Copy link
Contributor Author

Thats correct. CRDs have all inline schemas, so there are no $ref allowed.

Native types sometimes use $ref in their schemas to refer to other types' schemas. If we have a circular $ref dependency anywhere then the schema is recursive.

@swastik959
Copy link
Contributor

/assign

@swastik959
Copy link
Contributor

hi @alexzielenski I have made a pr please can you review it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants