Skip to content

Commit dc92233

Browse files
author
lukma99
committed
code optimizations in run script
1 parent e141113 commit dc92233

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

run.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,17 @@
22

33
NEW_ARGS=""
44
COMMAND=""
5-
CURRENT_CONTEXT=$(kubectl config current-context)
6-
CURRENT_NAMESPACE=$(kubectl config view --minify | grep namespace | cut -d ':' -f 2 | sed 's/^[ \t]*//;s/[ \t]*$//')
7-
85
HELM_SUDO_PROMPT=${HELM_SUDO_PROMPT:-false}
6+
97
if [ "$HELM_SUDO_PROMPT" = true ]; then
8+
CURRENT_CONTEXT=$(kubectl config current-context)
9+
CURRENT_NAMESPACE=$(kubectl config view --minify | grep namespace | cut -d ':' -f 2 | sed 's/^[ \t]*//;s/[ \t]*$//')
1010
read -p "WARNING: Currently in context '${CURRENT_CONTEXT}' using namespace '${CURRENT_NAMESPACE:-"default"}'. Continue? (y/N) " -r -n 1 yn
1111
case $yn in
1212
[Yy]* ) ;;
1313
* ) exit 0;;
1414
esac
15-
echo
15+
echo
1616
fi
1717

18-
for arg in "$@"
19-
do
20-
if [ ${arg} != "--"* ] && [ -z "${COMMAND}" ]; then
21-
COMMAND=${arg}
22-
fi
23-
NEW_ARGS="${NEW_ARGS} ${arg}"
24-
done
25-
26-
helm --kube-as-user ${USER} --kube-as-group system:masters ${NEW_ARGS}
18+
helm --kube-as-user ${USER} --kube-as-group system:masters "$@"

0 commit comments

Comments
 (0)