Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
Flag to auto install/upgrade tiller (#35)
Browse files Browse the repository at this point in the history
* Support installing and configuring tiller (server side component)

* On init wait for tiller to become ready
  • Loading branch information
msiegenthaler authored Dec 21, 2017
1 parent 53b0f22 commit 70f5794
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ resource_types:
* `admin_cert`: *Optional.* Base64 encoded PEM. Required if `cluster_url` is https and no `token` or 'token_path' is provided.
* `release`: *Optional.* Name of the release (not a file, a string). (Default: autogenerated by helm)
* `namespace`: *Optional.* Kubernetes namespace the chart will be installed into. (Default: default)
* `tiller_namespace`: *Optional.* Kubernetes namespace where tiller is running. (Default: kube-system)
* `helm_init_server`: *Optional.* Installs helm into the cluster if not already installed. (Default: false)
* `tiller_namespace`: *Optional.* Kubernetes namespace where tiller is running (or will be installed to). (Default: kube-system)
* `tiller_service_account`: *Optional* Name of the service account that tiller will use (only applies if helm_init_server is true).
* `repos`: *Optional.* Array of Helm repositories to initialize, each repository is defined as an object with `name` and `url` properties.

## Behavior
Expand Down
24 changes: 23 additions & 1 deletion assets/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,34 @@ setup_kubernetes() {
}

setup_helm() {
init_server=$(jq -r '.source.helm_init_server // "false"' < $1)
tiller_namespace=$(jq -r '.source.tiller_namespace // "kube-system"' < $1)

helm init -c --tiller-namespace $tiller_namespace > /dev/nulll
if [ "$init_server" = true ]; then
tiller_service_account=$(jq -r '.source.tiller_service_account // "default"' < $1)
helm init --tiller-namespace=$tiller_namespace --service-account=$tiller_service_account --upgrade
wait_for_service_up tiller-deploy 10
else
helm init -c --tiller-namespace $tiller_namespace > /dev/nulll
fi

helm version --tiller-namespace $tiller_namespace
}

wait_for_service_up() {
SERVICE=$1
TIMEOUT=$2
if [ "$TIMEOUT" -le "0" ]; then
echo "Service $SERVICE was not ready in time"
exit 1
fi
RESULT=`kubectl get endpoints --namespace=mario $SERVICE -o jsonpath={.subsets[].addresses[].targetRef.name} 2> /dev/null || true`
if [ -z "$RESULT" ]; then
delay 1000
wait_for_service_ready $SERVICE $((--TIMEOUT))
fi
}

setup_repos() {
repos=$(jq -r '(try .source.repos[] catch [][]) | (.name+" "+.url)' < $1)
tiller_namespace=$(jq -r '.source.tiller_namespace // "kube-system"' < $1)
Expand Down

0 comments on commit 70f5794

Please sign in to comment.