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

Errors with multidocument files? #17

Closed
chicocvenancio opened this issue Dec 4, 2020 · 3 comments
Closed

Errors with multidocument files? #17

chicocvenancio opened this issue Dec 4, 2020 · 3 comments

Comments

@chicocvenancio
Copy link

I was investigating using this instead of kubeval for a project. Scanning multi-document files I end up with errors that are not present if we split up the file into single document files.

eg:

dev.yaml - Deployment ***** failed validation: error unmarshalling resource: error converting YAML to JSON: yaml: did not find expected key
dev.yaml - Deployment ***** is invalid: kind must be one of the following: "Deployment"
dev.yaml - HorizontalPodAutoscaler ***** failed validation: error unmarshalling resource: error converting YAML to JSON: yaml: line 9: did not find expected '-' indicator
dev.yaml - Deployment ***** failed validation: error unmarshalling resource: error converting YAML to JSON: yaml: line 4: did not find expected key
dev.yaml - Deployment ***** is invalid: apiVersion must be one of the following: "apps/v1" - kind must be one of the following: "Deployment" - selector is required
dev.yaml - failed validation: error while parsing: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type struct { APIVersion string "yaml:\"apiVersion\""; Kind string "yaml:\"kind\""; Metadata struct { Name string "yaml:\"name\""; Namespace string "yaml:\"namespace\""; GenerateName string "yaml:\"generateName\"" } "yaml:\"Metadata\"" }
dev.yaml - StatefulSet ***** is invalid: apiVersion must be one of the following: "apps/v1" - kind must be one of the following: "StatefulSet" - selector is required - template is required - serviceName is required
dev.yaml - Job ***** is invalid: apiVersion must be one of the following: "batch/v1" - kind must be one of the following: "Job" - template is required
dev.yaml - Job ***** failed validation: error unmarshalling resource: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {}
@yannh
Copy link
Owner

yannh commented Dec 4, 2020

Hi @chicocvenancio , multi-files are supported , and should also be automatically tested... do you think you could share a minimal version of a multi-resource document that causes these failures, as well as the command you use to validate? Many thanks for the bug report!

@chicocvenancio
Copy link
Author

I'll try to create a minimal version.

@yannh
Copy link
Owner

yannh commented Jan 2, 2021

Closing for lack of infos - please reopen a new issue with the file that is failing! The acceptance tests do test a variety of Multi-document YAML files such as https://github.com/yannh/kubeconform/blob/master/fixtures/multi_valid.yaml and other multi* in the same folder - so this should work. I would be really interested in examples of files on which kubeconform fails! Thanks

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