2022-05-11 01:10:37 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# helm-chart-inflate.sh prometheus prometheus-community/prometheus
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
|
2022-05-11 01:10:41 +00:00
|
|
|
name="$1"
|
|
|
|
chart="$2"
|
|
|
|
base="$3"
|
2022-05-11 01:10:37 +00:00
|
|
|
|
2022-05-11 01:10:41 +00:00
|
|
|
mkdir -p "$base/inflated"
|
|
|
|
rm -rf "$base/inflated/$name"
|
2022-05-11 01:10:37 +00:00
|
|
|
|
2022-05-11 01:10:41 +00:00
|
|
|
valuesfile="$base/values/$name.yaml"
|
2022-05-11 01:10:37 +00:00
|
|
|
if [ -f $valuesfile ]; then
|
|
|
|
echo "Inflating template with values file: $valuesfile ..."
|
2022-05-11 01:10:41 +00:00
|
|
|
helm template $name $chart --output-dir $base/inflated -f $valuesfile
|
2022-05-11 01:10:37 +00:00
|
|
|
else
|
|
|
|
echo "Inflating template with default values ..."
|
2022-05-11 01:10:41 +00:00
|
|
|
helm template $name $chart --output-dir $base/inflated
|
2022-05-11 01:10:37 +00:00
|
|
|
fi
|
|
|
|
|
2022-05-11 01:10:41 +00:00
|
|
|
echo "YAML entries for $base/kustomzation.yaml:"
|
|
|
|
find $base/inflated/$name -iname '*.yaml' | xargs realpath --relative-to $base | sed 's/^/- /'
|