Extend helm-chart-inflate.sh to allow base customization

This commit is contained in:
Rob Watson 2022-05-11 03:10:41 +02:00
parent 705ea2bdd1
commit fd131276ff
2 changed files with 13 additions and 10 deletions

View File

@ -10,6 +10,7 @@ load-prod-env:
$(eval include prod/secrets/env)
$(eval export)
# Usage: make inflate name=prometheus chart=prometheus-community/prometheus
# Usage: make inflate name=prometheus chart=prometheus-community/prometheus [base=dev]
base=base
inflate:
@bin/helm-chart-inflate.sh $(name) $(chart)
@bin/helm-chart-inflate.sh $(name) $(chart) $(base)

View File

@ -6,19 +6,21 @@
set -euo pipefail
IFS=$'\n\t'
name=$1
chart=$2
name="$1"
chart="$2"
base="$3"
rm -rf base/inflated/$name
mkdir -p "$base/inflated"
rm -rf "$base/inflated/$name"
valuesfile="base/values/$name.yaml"
valuesfile="$base/values/$name.yaml"
if [ -f $valuesfile ]; then
echo "Inflating template with values file: $valuesfile ..."
helm template $name $chart --output-dir base/inflated -f $valuesfile
helm template $name $chart --output-dir $base/inflated -f $valuesfile
else
echo "Inflating template with default values ..."
helm template $name $chart --output-dir base/inflated
helm template $name $chart --output-dir $base/inflated
fi
echo "YAML entries for base/kustomzation.yaml:"
find base/inflated/$name -iname '*.yaml' | xargs realpath --relative-to base | sed 's/^/- /'
echo "YAML entries for $base/kustomzation.yaml:"
find $base/inflated/$name -iname '*.yaml' | xargs realpath --relative-to $base | sed 's/^/- /'