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

not detecting issues in simple deployment file #148

Closed
nosleep77 opened this issue Nov 9, 2022 · 2 comments
Closed

not detecting issues in simple deployment file #148

nosleep77 opened this issue Nov 9, 2022 · 2 comments

Comments

@nosleep77
Copy link

I generated a simple deployment file

kubectl create deploy nginx --image nginx -o yaml

I then tinker with this section

spec: containers: - image: nginx name: nginx

spec: containers: - image: nginx name: nginx

I move containers to spec level as seen above.

kubeconform says no issues
$ kubeconform deployment/deploy-nginx.yaml ; echo $? 0

dry-run=server says there is a problem

$ k apply -f deployment/deploy-nginx.yaml --dry-run=server The Deployment "nginx" is invalid: spec.template.spec.containers: Required value

@eyarz
Copy link
Contributor

eyarz commented Nov 9, 2022

Kubeconform only validates manifests using the OpenAPI specifications.
There are some additional server-side validations that are not part of the OpenAPI specifications and are performed by the Kubernetes controllers. Those server-side validations are not covered by Kubeconform (examples: #65, #122, #142). You can use a 3rd-party tool or the kubectl --dry-run=server command to fill the missing gap.

@yannh
Copy link
Owner

yannh commented Jan 22, 2023

Hi @nosleep77 , as @eyarz mentionned - Kubeconform does "dumb" validation using JSON schema. Controllers might have additional server-side logic not reflected in their OpenAPI/JsonSchema spec.

@yannh yannh closed this as completed Jan 22, 2023
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

3 participants