Last active
November 8, 2023 17:40
-
-
Save Lp-Francois/07c2ce45a7c205129d6cf4402bd86608 to your computer and use it in GitHub Desktop.
Lint and validate helm chart with kubeconform and helm lint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -o errexit | |
| set -o pipefail | |
| # Activate debug: | |
| # set -x | |
| # Require https://github.com/yannh/kubeconform | |
| # Require https://helm.sh/docs/helm/helm_install/ | |
| CHART="charts/http-service" | |
| # https://github.com/datreeio/CRDs-catalog/tree/main | |
| # Beware! Some CRDs are outdated, if it is the case, either open a PR or download the schemas in local, and pass the location | |
| # with a flag. You can also use a kubeconform flag to skip the CRD, eg "-skip=DopplerSecret". | |
| SCHEMAS_LOCATION='https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' | |
| kubeconform_config=( | |
| "-strict" | |
| "-ignore-missing-schemas" | |
| "-schema-location" "default" | |
| "-schema-location" $SCHEMAS_LOCATION | |
| "-verbose" | |
| "-summary" | |
| ) | |
| echo -e '\n› Lint' $CHART | |
| helm lint $CHART | |
| echo -e '\n› Kube manifest validation for' $CHART | |
| helm template $CHART | kubeconform "${kubeconform_config[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment