kubeval - usage demo and boilerplate script
Dear developers of the GitLab chart
I like this repository and the things I can learn from the GitLab organization in general
I write to you hoping to contribute something back.
In this PR you will find a Python script I use while developing a Helm chart. The script does four things.
- Uses
helm lint
, inspecting the unrendered charts - Uses
helm template
, rendering the charts - Uses
yamllint
, lints the yaml in the rendered chart resources - Uses
kubeval
, validating the k8s resources against the k8s API
About using the script
For this script to function, you must install yamllint
(the python package) and kubeval.
# install the python package yamllint
# see: https://github.com/adrienverge/yamllint
pip install yamllint
# install kubeval on linux
# see: https://github.com/garethr/kubeval
LATEST=curl --silent "https://api.github.com/repos/garethr/kubeval/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
wget https://github.com/garethr/kubeval/releases/download/$LATEST/kubeval-linux-amd64.tar.gz
tar xf kubeval-darwin-amd64.tar.gz
mv kubeval /usr/local/bin