Closed elblivion closed 7 years ago
The schema says this has not be an array https://github.com/garethr/kubernetes-json-schema/blob/master/master-standalone/deployment.json#L2720-L2726.
If Kubernetes accepts this it should instead be described as:
"type": [ "array", "null" ]
I'll post something to SIG API Machinery and see if this is correct. If so I'll file an upstream bug and also in the meantime splice this into the generated schemas.
So, the use of protocol buffers in Kubernetes means that it can't distinguish between null and empty arrays. And OpenAPI 2.0 doesn't support multiple types as shown in the comment above. Tracking this for upstream in the linked issue, which also has more context.
I've just updated the upstream schemas with this fix: https://github.com/garethr/kubernetes-json-schema/commit/12719afdc584f6a5f8a28432d4c56c8691b7f841
I've also added tests to kubeval to demonstrate it working as intended: https://github.com/garethr/kubeval/commit/b635ef571a4fb8d314f534a54dea39af69259f65
For a Kubernetes Dashboard spec, also downloaded, the k8s API happily accepts this:
Kubeval, however, doesn't like it: