Skip to content

Commit

Permalink
makefile target for helm templating charts (#1660)
Browse files Browse the repository at this point in the history
  • Loading branch information
jschaul authored and smatting committed Jul 13, 2021
1 parent a1ae0e8 commit 704489d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $(*)

24 changes: 24 additions & 0 deletions hack/bin/helm-template.sh
Original file line number Diff line number Diff line change
@@ -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[*]}

0 comments on commit 704489d

Please sign in to comment.