From 721f9b73260708af8b6a12c9288091a9c3bddaf4 Mon Sep 17 00:00:00 2001 From: jschaul Date: Tue, 13 Jul 2021 12:28:00 +0200 Subject: [PATCH] makefile target for helm templating charts --- Makefile | 8 ++++++++ hack/bin/helm-template.sh | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 hack/bin/helm-template.sh diff --git a/Makefile b/Makefile index 52583a0911a..1804a8d9d4c 100644 --- a/Makefile +++ b/Makefile @@ -416,3 +416,11 @@ kind-restart-%: .local/kind-kubeconfig kubectl delete pod -n $(NAMESPACE) -l wireService=$(*) && \ kubectl delete pod -n $(NAMESPACE)-fed2 -l wireService=$(*) +# This target can be used to template a helm chart with values filled in from +# hack/helm_vars (what CI uses) as overrrides, if available. This allows debugging helm +# templating issues without actually installing anything, and without needing +# access to a kubernetes cluster. e.g.: +# make helm-template-wire-server +helm-template-%: clean-charts charts-integration + ./hack/bin/helm-template.sh $(*) + diff --git a/hack/bin/helm-template.sh b/hack/bin/helm-template.sh new file mode 100755 index 00000000000..0cd1306f56e --- /dev/null +++ b/hack/bin/helm-template.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# This script can be used to template a helm chart with values filled in from +# hack/helm_vars as overrrides, if available. This allows debugging helm +# templating issues without actually installing anything, and without needing +# access to a kubernetes cluster +USAGE="Usage: $0" + +set -e + +chart=${1:?$USAGE} + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +TOP_LEVEL="$DIR/../.." +CHARTS_DIR="${TOP_LEVEL}/.local/charts" + +valuesfile="${DIR}/../helm_vars/${chart}/values.yaml" +declare -a options=() +if [ -f "$valuesfile" ]; then + options+=(-f "$valuesfile") +fi + +"$DIR/update.sh" "$CHARTS_DIR/$chart" +helm template $"chart" "$CHARTS_DIR/$chart" ${options[*]}