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

Commit

Permalink
Merge pull request #46 from Typositoire/fix/namespace_create_install
Browse files Browse the repository at this point in the history
Moving create_ns outside of eval + fix unwanted namespace creation
  • Loading branch information
rimusz authored Apr 26, 2019
2 parents 92018a5 + 0fc14f2 commit f7f4a33
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: "tiller"
version: "0.7.1"
version: "0.8.0"
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"
Expand Down
25 changes: 15 additions & 10 deletions scripts/tiller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,26 @@ helm_env() {
# Set namespace
echo export TILLER_NAMESPACE="${1}"
export TILLER_NAMESPACE="${1}"
if [[ "${CREATE_NAMESPACE_IF_MISSING}" == "true" ]]; then
create_ns $1
fi
fi
echo export HELM_HOST=127.0.0.1:${HELM_TILLER_PORT}
export HELM_HOST=127.0.0.1:${HELM_TILLER_PORT}
}
create_ns() {
kubectl get ns $1 &> /dev/null
if [[ $? -eq 1 ]]
then
kubectl create ns $1 &> /dev/null
kubectl patch ns $1 -p \
"{\"metadata\": {\"labels\": {\"name\": \"${1}\"}}}" &> /dev/null
if [[ "${CREATE_NAMESPACE_IF_MISSING}" == "true" ]]; then
if [[ "$3" == "upgrade" ]] || [[ "$3" == "install" ]]; then
echo "Creating tiller namespace (if missing): $1"
set +e
kubectl get ns $1 &> /dev/null
if [[ $? -eq 1 ]]
then
set -e
kubectl create ns $1 &> /dev/null
kubectl patch ns $1 -p \
"{\"metadata\": {\"labels\": {\"name\": \"${1}\"}}}" &> /dev/null
fi
fi
fi
}
Expand Down Expand Up @@ -206,6 +210,7 @@ run)
done
trap stop_tiller EXIT
eval '$(helm_env "${start_args[@]}")'
create_ns "${start_args[@]}" "${args[@]}"
run_tiller "${start_args[@]}"
# shellcheck disable=SC2145
if [[ "${HELM_TILLER_SILENT}" == "false" ]]; then
Expand Down

0 comments on commit f7f4a33

Please sign in to comment.