Created
October 2, 2018 03:03
-
-
Save kokwai/fe352638f8f2495176e337a9c7a1efa3 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
tls="" | |
enableauth="" | |
helm_tls="" | |
: "${HELM_BASE_CMD:=helm}" | |
# Check to see if the we get std err back running a helm version --tls, if no output appeats, set helm_tls, statement looks at text of std err, not return code from command | |
[[ `${HELM_BASE_CMD} version --tls 2>&1 >/dev/null` ]] || helm_tls=true | |
help=`${HELM_BASE_CMD} $@ --help | egrep "^[ ]*\--enable-auth|^[ ]*\--tls " | tr -s ' ' | cut -f2 -d' ' | xargs echo ` || { echo -n NONE | tr '\n' ' '; } 2>&1 >/dev/null | |
[[ `echo $help | egrep "\--enable-auth"` && $helm_tls ]] && enableauth="--enable-auth" || enableauth="" | |
[[ `echo $help | egrep "\--tls"` && $helm_tls ]] && tls="--tls" || tls="" | |
${HELM_BASE_CMD} $@ $tls $enableauth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment