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

Issue with commented out array values #14

Closed
elblivion opened this issue Jul 10, 2017 · 2 comments
Closed

Issue with commented out array values #14

elblivion opened this issue Jul 10, 2017 · 2 comments

Comments

@elblivion
Copy link

For a Kubernetes Dashboard spec, also downloaded, the k8s API happily accepts this:

    spec:
      containers:
        <...>
        args:
          # Uncomment the following line to manually specify Kubernetes API server Host
          # If not specified, Dashboard will attempt to auto discover the API server and connect
          # to it. Uncomment only if the default does not work.
          # - --apiserver-host=http://my-address:port

Kubeval, however, doesn't like it:

The document ../../contentful/cf-infra-stacks/kubeconfigs/staging/us-east-1/delivery-k8s-002/kubernetes-dashboard/dashboard.yaml is not a valid Deployment
--> spec.template.spec.containers.0.args: Invalid type. Expected: array, given: null
@garethr
Copy link
Collaborator

garethr commented Jul 20, 2017

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.

@garethr
Copy link
Collaborator

garethr commented Jul 21, 2017

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: garethr/kubernetes-json-schema@12719af

I've also added tests to kubeval to demonstrate it working as intended: b635ef5

@garethr garethr closed this as completed Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants