Skip to content

kubeval - usage demo and boilerplate script

Erik Sundell requested to merge consideRatio/gitlab:kubeval into master

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.

  1. Uses helm lint, inspecting the unrendered charts
  2. Uses helm template, rendering the charts
  3. Uses yamllint, lints the yaml in the rendered chart resources
  4. Uses kubeval, validating the k8s resources against the k8s API

Example execution gitlab-kubeval-demo


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

Merge request reports