kubeval icon indicating copy to clipboard operation
kubeval copied to clipboard

kubeval of "helm create test-helm" fails

Open gmacario opened this issue 2 years ago • 1 comments

Hello and apologies in advance if this is a newbie question.

I have been experiencing troubles in having kubeval validate even simple Helm charts - see https://github.com/aquariophilie/node-koa-boilerplate/pull/9 as an example.

I managed to reproduce the problem with one of the easiest test I could think about

helm version
helm create test-helm

docker run -it \
    -v `pwd`/test-helm:/test-helm \
    garethr/kubeval test-helm/*

Here is the result:

gmacario@gmpowerhorse:~ $ helm version
version.BuildInfo{Version:"v3.7.0", GitCommit:"eeac83883cb4014fe60267ec6373570374ce770b", GitTreeState:"clean", GoVersion:"go1.16.8"}
gmacario@gmpowerhorse:~ $ helm create test-helm
Creating test-helm
gmacario@gmpowerhorse:~ $ docker run -it \
>     -v `pwd`/test-helm:/test-helm \
>     garethr/kubeval test-helm/*
ERR  - Could not open file test-helm/charts
ERR  - test-helm/Chart.yaml: Missing 'metadata' key
ERR  - Could not open file test-helm/templates
ERR  - test-helm/values.yaml: Missing 'metadata' key
gmacario@gmpowerhorse:~ $

You can find more details at https://github.com/aquariophilie/node-koa-boilerplate/issues/7 and https://github.com/aquariophilie/node-koa-boilerplate/pull/10

Thanks for your attention -- Gianpaolo

gmacario avatar May 01 '22 05:05 gmacario

According docs https://www.kubeval.com/#helm.

If you do helm template for generating RAW YAML manifests, then this output contains comments with path for these templates e.g. # Source: my-chart/templates/frontend.yaml. This output can be sent to kubeval which will validate every YAML manifest according the path in the comment.

Something like this could work

$ helm template my-chart ./my-chart | kubeval

PASS - my-chart/templates/frontend.yaml contains a valid Deployment (default.frontend)

jakuboskera avatar Jul 07 '22 13:07 jakuboskera