Skip to content

Instantly share code, notes, and snippets.

@shendongming
Last active October 30, 2020 13:29
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 shendongming/96ffd00a129fb51b8c11b6d5d60bde6b to your computer and use it in GitHub Desktop.
Save shendongming/96ffd00a129fb51b8c11b6d5d60bde6b to your computer and use it in GitHub Desktop.
helm-tls alias
#!/usr/bin/env bash
function helm-tls() {
flag=""
if [[ "$1" == "delete" ]] || [[ "$1" == "diff" ]] || [[ "$1" == "get" ]] || [[ "$1" == "history" ]] || [[ "$1" == "install" ]] || [[ "$1" == "list" ]] || [[ "$1" == "reset" ]] || [[ "$1" == "rollback" ]] || [[ "$1" == "status" ]] || [[ "$1" == "test" ]] || [[ "$1" == "upgrade" ]] || [[ "$1" == "version" ]]; then
flag="--tls"
fi
helm ${1+"$@"} $flag
}
unalias helm
alias helm=helm-tls
# GET --tls flags
function export_new_condtion() {
helm help | grep 'Available Commands' -A 28 | tail -n 28 | awk '{print "helm " $1 " --help | grep '\''\\-\\-tls'\'' | wc -l " }' | sh -x &>step1.out
cat step1.out | grep -E '\-\-help|[0-9]' | grep 6 -B 1 >step2.out
cat step2.out | grep '+ helm' | awk 'BEGIN{ORS=" "}{print p "[[ \"$1\" == \"" $3 "\" ]]" ; p=" || " }'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment