recursive schemas not supported
alexzielenski opened this issue · 6 comments
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.
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
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
@alexzielenski if I am not wrong the schema to recursive it should have a $ref right ?
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.
/assign
hi @alexzielenski I have made a pr please can you review it