Created
January 26, 2019 16:58
-
-
Save afirth/98c309400c9d1b70eb4e2ec6045724d9 to your computer and use it in GitHub Desktop.
tillerless helm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# this starts a local tiller service with secret storage driver, then runs helm commands against it | |
# setting $TILLER_NAMESPACE is strongly recommended | |
# usage: ./helm.sh <valid helm args> | |
# afirth 2018 | |
set -eu -o pipefail | |
# default to use if TILLER_NAMESPACE is not set | |
# kube-system (the default) is not a great idea | |
# but you can export TILLER_NAMESPACE=kube-system if you like | |
default_namespace=cloudbuild-tiller | |
#the default | |
tport=44134 | |
# create tiller-namespace if it doesn't exist (helm --init would usually do this with server-side tiller' | |
set +u | |
if [ -z "$TILLER_NAMESPACE" ]; then | |
echo "\$TILLER_NAMESPACE is empty. USING $default_namespace." | |
export TILLER_NAMESPACE=$default_namespace | |
else | |
kubectl get namespace $TILLER_NAMESPACE || \ | |
(echo "Creating tiller namespace $TILLER_NAMESPACE" && \ | |
kubectl create namespace $TILLER_NAMESPACE) | |
fi | |
set -u | |
#inherits TILLER_NAMESPACE | |
tiller --storage=secret --listen localhost:44134 & | |
#wait for tiller to start | |
while ! echo exit | nc localhost $tport; do sleep 1; done | |
export HELM_HOST=localhost:$tport | |
helm "$@" | |
ec=$? | |
pkill tiller | |
exit $ec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment