instrumenta / kubeval

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

Kubeval fails validation when yaml contains multi-line scalar #38

Closed hobbsh closed 6 years ago

hobbsh commented 6 years ago

Is it expected behavior for kubeval to fail validation on a configmap that contains a multi-line scalar, i.e. (from the docs):

data:
  game.properties: |
    enemies=aliens
    lives=3
    enemies.cheat=true
    enemies.cheat.level=noGoodRotten
    secret.code.passphrase=UUDDLRLRBABAS
    secret.code.allowed=true
    secret.code.lives=30

If that data is crunched into JSON, it validates fine. From a readability/maintainability standpoint it's much easier to be able to use the multi-line scalar, especially with configmaps like nginx. Is this something we will need to use a custom schema for?

The actual error is:

* Failed to decode YAML from my-configmap.yml
Exited with code 123
garethr commented 6 years ago

Thanks for reporting. I'll add a test case for this and try and find a fix. This could be an issue with the YAML parser I'm using?

hobbsh commented 6 years ago

So, this appears to be an issue with the prebuilt linux binary for 0.7.0. I just built it myself locally because I planned on helping solve this problem - went to test a configmap with a multiline scalar and it passes.

For whatever reason, the pre-built 0.7.1 binary does not seem to have this problem

garethr commented 6 years ago

Mmmm, interesting. I'll have a look at why that might be, but glad it's working now. If you want to provide a full config example I can include it in the test suite so I can catch future issues like this. Just reply here, although I'll close the issue for now. Thanks.