Skip to content

Instantly share code, notes, and snippets.

@kokwai
Created October 2, 2018 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kokwai/fe352638f8f2495176e337a9c7a1efa3 to your computer and use it in GitHub Desktop.
Save kokwai/fe352638f8f2495176e337a9c7a1efa3 to your computer and use it in GitHub Desktop.
#!/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