kubeval icon indicating copy to clipboard operation
kubeval copied to clipboard

Should not PASS on empty input

Open ambis opened this issue 4 years ago • 3 comments

Considering that kubeval is probably run mostly in CI pipelines, I think it is funny that kubeval exits with 0 when it gets an empty input.

Do you guys consider that it is more likely that you would intentionally pass empty input to kubeval, OR could that possibly be a sign of a previous error that there is no input to validate?

I know you can't change this outright for BC, but a flag for "--fail-if-empty" would be a welcome addition for CI environments.

ambis avatar Feb 24 '20 10:02 ambis

IMO this should be opt-in. Helm can create empty files if the template does not write any content, such as the case of a conditional file, and this should not cause kubeval to fail.

hobti01 avatar Apr 24 '20 13:04 hobti01

I would be interested with what you define as "empty input" - a folder with at least a single file that is empty? Should a file with an empty resource, eg

`

Kind: Deployment [A valid resource here]


` Notice the two yaml separators ^ - seems like this is breaking the Markdown rendering sorry.

Or do you mean - when kubeval reads from stdin, and stdin is empty? could you clarify? Thanks!

yannh avatar Nov 02 '20 08:11 yannh

I agree, if passed empty yaml there should be an option to fail. This would be incredibly useful as Kustomize, on error, produces empty manifests.

Kampe avatar Dec 30 '20 22:12 Kampe