-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 856f6d7
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Helmns | ||
|
||
helmns is a [Helm](http://helm.sh) cli wrapper forcing `--tiller-namespace` to match kubectl context. | ||
|
||
This is meant to simplify management for Kubernetes clusters with RBAC enabled and where tiller is heavily locked down per namespace. | ||
|
||
----- | ||
|
||
## Installation | ||
|
||
Since `helmns` is written in Bash, it can run in shells that support POSIX standards. | ||
|
||
- Download the `helmns` script | ||
- Either: | ||
- save to somewhere in your `PATH`, | ||
- or save to a directory, then create symlinks to `helmns` from somewhere in your `PATH`, like `/usr/local/bin` | ||
- Make `helmns` executable (`chmod +x ...`) | ||
|
||
----- | ||
|
||
Heavily based on [ahmetb/kubens](https://github.com/ahmetb/kubectx) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
# | ||
# helmns(1) is a utility to force tiller-namespace to current namespace | ||
|
||
[[ -n $DEBUG ]] && set -x | ||
|
||
set -eou pipefail | ||
IFS=$'\n\t' | ||
|
||
current_context() { | ||
kubectl config view -o=jsonpath='{.current-context}' | ||
} | ||
|
||
current_namespace() { | ||
local cur_ctx=$(current_context) | ||
ns="$(kubectl config view -o=jsonpath="{.contexts[?(@.name==\"${cur_ctx}\")].context.namespace}")" | ||
if [[ -z "${ns}" ]]; then | ||
echo "default" | ||
else | ||
echo "${ns}" | ||
fi | ||
} | ||
|
||
exec helm --tiller-namespace "$(current_namespace)" "$@" |