Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ kind-restart-%: .local/kind-kubeconfig
# 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 $(*)
# make helm-template
helm-template: clean-charts charts-integration
./hack/bin/helm-template.sh

1 change: 1 addition & 0 deletions changelog.d/5-internal/helmfile-template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make the helm-template script use helmfile
28 changes: 14 additions & 14 deletions hack/bin/helm-template.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#!/usr/bin/env bash

# This script can be used to template a helm chart with values filled in from
# This script can be used to render all helm charts 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
# Call the script directly (optionally with `--skip-deps`), or via the
# `helm-template` make target.

chart=${1:?$USAGE}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happened to this variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to render a single chart with helmfile.

set -e

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TOP_LEVEL="$DIR/../.."
CHARTS_DIR="${TOP_LEVEL}/.local/charts"
: "${FEDERATION_DOMAIN_BASE:=example.com}"
: "${FEDERATION_DOMAIN:=namespace1.example.com}"
: "${NAMESPACE:=namespace1}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this syntax. Is that the same as

NAMESPACE=${NAMESPACE:-"namespace1"}

? i.e. set-to-default-if-not-exists? Or this hardcodes/overrides this variable to always be that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's the same as that. ${x:=foo} sets $x to foo if not set, and returns the value of $x. The colon is just an empty statement. It's a way to evaluate an expression (usually with side effects), without executing any command.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the explanations!


valuesfile="${DIR}/../helm_vars/${chart}/values.yaml"
certificatesfile="${DIR}/../helm_vars/${chart}/certificates.yaml"
declare -a options=()
if [ -f "$valuesfile" ]; then
options+=(-f "$valuesfile")
fi
if [ -f "$certificatesfile" ]; then
options+=(-f "$certificatesfile")
export FEDERATION_DOMAIN_BASE
export FEDERATION_DOMAIN
export NAMESPACE

if [ ! -f "$DIR/../helm_vars/wire-server/certificates-namespace1.yaml" ]; then
"$DIR/selfsigned-kubernetes.sh" namespace1
fi

"$DIR/update.sh" "$CHARTS_DIR/$chart"
helm template $"chart" "$CHARTS_DIR/$chart" ${options[*]}
helmfile -f "$DIR/../helmfile-single.yaml" template "$@"