From 291510e2cc8cc2dbc281fbaba75cbc80d668d544 Mon Sep 17 00:00:00 2001 From: rimas Date: Thu, 19 Sep 2019 10:22:01 +0100 Subject: [PATCH 1/2] Revert code to v0.8.4, remove build options Signed-off-by: rimas --- .circleci/config.yml | 2 -- Makefile | 17 -------------- README.md | 21 +---------------- plugin.yaml | 2 +- scripts/build-patch.sh | 51 ------------------------------------------ scripts/build.sh | 40 --------------------------------- scripts/tiller.sh | 34 +++------------------------- 7 files changed, 5 insertions(+), 162 deletions(-) delete mode 100644 Makefile delete mode 100755 scripts/build-patch.sh delete mode 100755 scripts/build.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 367b50c..40a3e03 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,8 +8,6 @@ jobs: - run: name: lint command: | - shellcheck -x scripts/build-patch.sh - shellcheck -x scripts/build.sh shellcheck -x scripts/install.sh shellcheck -x scripts/semver shellcheck -x scripts/tiller.sh diff --git a/Makefile b/Makefile deleted file mode 100644 index b5becc0..0000000 --- a/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -TILLER_VERSION ?= 2.10.0 -TILLER_DOCKER_REGISTRY ?= gcr.io/kubernetes-helm/tiller -GCS_BUCKET ?= helm-tiller - -.PHONY: build -build: - $(eval export TILLER_VERSION) - $(eval export TILLER_DOCKER_REGISTRY) - $(eval export GCS_BUCKET) - scripts/build.sh - -.PHONY: build-patch -build-patch: - $(eval export TILLER_VERSION) - $(eval export TILLER_DOCKER_REGISTRY) - $(eval export GCS_BUCKET) - scripts/build-patch.sh diff --git a/README.md b/README.md index 68f3ba8..c59eb04 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Check it out my new blog post [How to migrate from Helm v2 to Helm v3](https://r ## Installation -Install Helm client as per one of recomended [ways](https://docs.helm.sh/using_helm/#installing-the-helm-client). +Install Helm client as per one of recommended [ways](https://docs.helm.sh/using_helm/#installing-the-helm-client). **Note:** Initialize helm with `helm init --client-only`, flag `--client-only` is a must as otherwise you will get `Tiller` installed in to Kubernetes cluster. @@ -144,22 +144,3 @@ $ minikube start $ helm tiller stop $ helm tiller start ``` - -## Tiller binaries - -### Tiller binaries for v2.11 Helm and above versions - -Beginning of Helm v2.11 release, `helm` archive file comes packed with `tiller` binary as well. -Plugin will check the version and download the right archive file. No more building/retrieving of -`tiller` binary is needed anymore. - - -### Build patched Tiller binaries and publish them for pre v2.10 Helm - -**Note:** `Tiller`in pre `v2.10` does not support kubeconfig files which use user authentication via `auth-provider`, so you need to use this approach for all pre `v2.10` `tiller` releases. - -To build patched `MacOS` and `Linux` `tiller` binaries and then publish them to `GCS` bucket run on your Mac: - -```console -TILLER_VERSION=2.9.1 GCS_BUCKET=my_bucket make build-patch -``` diff --git a/plugin.yaml b/plugin.yaml index 0e99d30..f8de3ac 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,6 +1,6 @@ --- name: "tiller" -version: "0.8.6" +version: "0.8.7" usage: "Please see https://github.com/rimusz/helm-tiller for usage" description: "Start a Tiller server locally, aka Tillerless Helm" command: "$HELM_PLUGIN_DIR/scripts/tiller.sh" diff --git a/scripts/build-patch.sh b/scripts/build-patch.sh deleted file mode 100755 index 4e41079..0000000 --- a/scripts/build-patch.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -HELM_PLUGIN_DIR=$(pwd) - -# -cd "$GOPATH" -rm -fr src/k8s.io/helm -mkdir -p src/k8s.io -cd src/k8s.io -git clone https://github.com/kubernetes/helm.git -cd helm -git checkout v"$TILLER_VERSION" -# Patch tiller.go with client auth plugins -# Get OS type -unamestr=$(uname) -if [[ "$unamestr" == "Linux" ]] -then - SED='sed -i' -else - SED='sed -i ""' -fi -# Patch tiller.go file -# shellcheck disable=SC2086 -"${SED}" '/\"google.golang.org\/grpc\/keepalive\"/!{p;d;};n;r '${HELM_PLUGIN_DIR}'/scripts/tiller.patch' cmd/tiller/tiller.go -rm -f 'cmd/tiller/tiller.go""' -# -# fetch dependencies -make bootstrap -# Build Darwin binary -make build -# Build Linux amd64 binary -make docker-binary -# -# tar Darwin binary -cd bin/ -tar czvf tiller-v"${TILLER_VERSION}"_Darwin_x86_64.tgz tiller -# Upload to GCS bucket -echo "Upload Tiller Darwin tgz to GCS bucket" -gsutil cp tiller-v"${TILLER_VERSION}"_Darwin_x86_64.tgz gs://"${GCS_BUCKET}" -# -# tar linux binary -cd ../rootfs/ -tar czvf tiller-v"${TILLER_VERSION}"_Linux_x86_64.tgz tiller -# Upload to GCS bucket -echo "Upload Tiller Linux tgz to GCS bucket" -gsutil cp tiller-v"${TILLER_VERSION}"_Linux_x86_64.tgz gs://"${GCS_BUCKET}" -# -# Make tgz files public -gsutil acl ch -u AllUsers:R gs://"${GCS_BUCKET}"/* diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100755 index 758147d..0000000 --- a/scripts/build.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -# shellcheck disable=SC2034 -HELM_PLUGIN_DIR=$(pwd) - -# Build Darwin binary -cd "$GOPATH" -rm -fr src/k8s.io/helm -mkdir -p src/k8s.io -cd src/k8s.io -git clone https://github.com/kubernetes/helm.git -cd helm -git checkout v"${TILLER_VERSION}" -make bootstrap build -cd bin -tar czvf tiller-v"${TILLER_VERSION}"_Darwin_x86_64.tgz tiller -# Upload to GCS bucket -echo "Upload Tiller Darwin tgz to GCS bucket" -gsutil cp tiller-v"${TILLER_VERSION}"_Darwin_x86_64.tgz gs://"${GCS_BUCKET}" -rm -f tiller-v"${TILLER_VERSION}"_Darwin_x86_64.tgz - -# Fetch Linux binary -echo "Extracting Tiller Linux binary from the docker image" -id=$(docker create "$TILLER_DOCKER_REGISTRY":v"$TILLER_VERSION") -mkdir -p ~/tmp/tiller -docker cp "$id":tiller - > ~/tmp/tiller/tiller.tar -docker rm -v "$id" -cd ~/tmp/tiller -tar xvf ~/tmp/tiller/tiller.tar -rm -f tiller.tar -tar czvf tiller-v"${TILLER_VERSION}"_Linux_x86_64.tgz tiller -# Upload to GCS bucket -echo "Upload Tiller Linux tgz to GCS bucket" -gsutil cp tiller-v"${TILLER_VERSION}"_Linux_x86_64.tgz gs://"${GCS_BUCKET}" -rm -rf tiller - -# Make tgz files public -gsutil acl ch -u AllUsers:R gs://"${GCS_BUCKET}"/* diff --git a/scripts/tiller.sh b/scripts/tiller.sh index 865c242..b98eb26 100755 --- a/scripts/tiller.sh +++ b/scripts/tiller.sh @@ -155,32 +155,13 @@ tiller_env() { fi } -tiller_pid_file() { - - if [ -z "$TMPDIR" ]; then - export TMPDIR="/tmp" - fi - echo "$TMPDIR/helm-tiller-${HELM_TILLER_PORT}.pid" -} - -tiller_save_pid() { - local tiller_pid="$1" - local tiller_pid_file - tiller_pid_file=$(tiller_pid_file) - echo "$tiller_pid" > "$tiller_pid_file" -} - start_tiller() { tiller_env PROBE_LISTEN_FLAG="--probe-listen=127.0.0.1:${HELM_TILLER_PROBE_PORT}" # check if we have a version that supports the --probe-listen flag ./bin/tiller --help 2>&1 | grep probe-listen > /dev/null || PROBE_LISTEN_FLAG="" - # shellcheck disable=SC2188 - ( - ./bin/tiller --storage=${HELM_TILLER_STORAGE} --listen=127.0.0.1:${HELM_TILLER_PORT} ${PROBE_LISTEN_FLAG} --history-max=${HELM_TILLER_HISTORY_MAX} & - tiller_save_pid "$!" - ) 2>"${HELM_TILLER_LOGS_DIR}" - if [[ "${HELM_TILLER_SILENT}" == "false" ]]; then + ( ./bin/tiller --storage=${HELM_TILLER_STORAGE} --listen=127.0.0.1:${HELM_TILLER_PORT} ${PROBE_LISTEN_FLAG} --history-max=${HELM_TILLER_HISTORY_MAX} & 2>"${HELM_TILLER_LOGS_DIR}") + if [[ "${HELM_TILLER_SILENT}" == "false" ]]; then echo "Tiller namespace: $TILLER_NAMESPACE" fi } @@ -194,16 +175,7 @@ stop_tiller() { if [[ "${HELM_TILLER_SILENT}" == "false" ]]; then echo "Stopping Tiller..." fi - local tiller_pid_file - tiller_pid_file=$(tiller_pid_file) - if ! [ -f "$tiller_pid_file" ]; then - echo "can not find tiller pid file $tiller_pid_file" 1>&2 - exit 1 - fi - local tiller_pid - tiller_pid="$(cat "$tiller_pid_file")" - kill -9 "$tiller_pid" - rm -f "$tiller_pid_file" + pkill -9 -f ./bin/tiller } COMMAND=$1 From 2d50917adf6766027c1c4fbc8993ea50ebe1792a Mon Sep 17 00:00:00 2001 From: rimas Date: Thu, 19 Sep 2019 10:25:24 +0100 Subject: [PATCH 2/2] fix shellcheck errors Signed-off-by: rimas --- scripts/tiller.patch | 2 -- scripts/tiller.sh | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 scripts/tiller.patch diff --git a/scripts/tiller.patch b/scripts/tiller.patch deleted file mode 100644 index 1e995fb..0000000 --- a/scripts/tiller.patch +++ /dev/null @@ -1,2 +0,0 @@ - // Import to initialize client auth plugins. - _ "k8s.io/client-go/plugin/pkg/client/auth" diff --git a/scripts/tiller.sh b/scripts/tiller.sh index b98eb26..97e0946 100755 --- a/scripts/tiller.sh +++ b/scripts/tiller.sh @@ -160,6 +160,7 @@ start_tiller() { PROBE_LISTEN_FLAG="--probe-listen=127.0.0.1:${HELM_TILLER_PROBE_PORT}" # check if we have a version that supports the --probe-listen flag ./bin/tiller --help 2>&1 | grep probe-listen > /dev/null || PROBE_LISTEN_FLAG="" + # shellcheck disable=SC2188 ( ./bin/tiller --storage=${HELM_TILLER_STORAGE} --listen=127.0.0.1:${HELM_TILLER_PORT} ${PROBE_LISTEN_FLAG} --history-max=${HELM_TILLER_HISTORY_MAX} & 2>"${HELM_TILLER_LOGS_DIR}") if [[ "${HELM_TILLER_SILENT}" == "false" ]]; then echo "Tiller namespace: $TILLER_NAMESPACE"