instrumenta / kubeval

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

Kubeval doesn't work correctly with xargs #95

Open ahawkins opened 6 years ago

ahawkins commented 6 years ago

kubeval incorrectly reads from stdin when used with xargs. Here's an example:

$ echo "foo.txt" > files.txt
$ xargs kubeval < files.txt
standard input appears to be an empty document

Here's a workaround: xargs -I m sh -c 'kubeval m < /dev/stdin' < files.txt.

scovl commented 1 year ago

This behavior is happening because the xargs command is reading the content of the file "files.txt" and using the kubeval command as an argument for this content, which is a string "foo.txt". However, the string "foo.txt" is not a valid document to be evaluated by kubeval. Try using it as follows:

xargs kubeval < <(cat files.txt)

It's not a bug, it's a matter of unconventional use of bash commands @garethr