From c39fb3480ace7db574a3fffaa2278a8a28200fff Mon Sep 17 00:00:00 2001 From: Adam Gray Date: Thu, 7 Mar 2019 07:12:29 +0000 Subject: [PATCH] add simple helm plugin support (#105) --- README.md | 1 + assets/common.sh | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 52dbdd9..51274f9 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ resource_types: * `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 properties `name`, `url` (required) username and password (optional). +* `plugins`: *Optional.* Array of Helm plugins to install, each defined as an object with properties `url` (required), `version` (optional). * `helm_host`: *Optional* Address of Tiller. Skips helm discovery process. (only applies if `helm_init_server` is false). * `tls_enabled`: *Optional* Uses TLS for all interactions with Tiller. (Default: false) * `helm_ca`: *Optional* Private CA that is used to issue certificates for Tiller clients and servers (only applies if tls_enabled is true). diff --git a/assets/common.sh b/assets/common.sh index 34f915b..04902a1 100644 --- a/assets/common.sh +++ b/assets/common.sh @@ -128,9 +128,20 @@ wait_for_service_up() { setup_repos() { repos=$(jq -c '(try .source.repos[] catch [][])' < $1) + plugins=$(jq -c '(try .source.plugins[] catch [][])' < $1) tiller_namespace=$(jq -r '.source.tiller_namespace // "kube-system"' < $1) local IFS=$'\n' + + for pl in $plugins; do + plurl=$(echo $pl | jq -cr '.url') + plversion=$(echo $pl | jq -cr '.version // ""') + if [ -n "$plversison" ]; then + plversionflag="--version $plversion" + fi + helm plugin install $plurl $plversionflag + done + for r in $repos; do name=$(echo $r | jq -r '.name') url=$(echo $r | jq -r '.url')