instrumenta / kubeval

Validate your Kubernetes configuration files, supports multiple Kubernetes versions
https://kubeval.com
Other
3.16k stars 229 forks source link

Validate partial document #109

Open retr0h opened 5 years ago

retr0h commented 5 years ago

This DaemonSet is incomplete yet kubeval validates as ok.

[jodewey:~/git/konfig] 2 % kubeval foo.yaml
The document foo.yaml contains a valid DaemonSet
[jodewey:~/git/konfig] % kubectl apply --dry-run --validate -f foo.yaml
daemonset.apps "foo" created (dry run)
[jodewey:~/git/konfig] % cat foo.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: foo
  namespace: foo

I would expect kubeval to report an issue, esp when not fully complete. I understand the data is valid for an update but not an initial deployment.

Anuraag-Advani commented 5 years ago

Can you try kubeval foo.yaml --strict?

garethr commented 5 years ago

The OpenAPI descriptions unfortunately don't contain information to make this determination I don't think. When I get a moment I'll check the actual schemas and see if it's possible to describe this in OpenAPI, if so I'll open an upstream issue.