50 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env zsh
use kubectl --group kube
#####################################################################
MAIN() {
local USAGE="
usage: [service] [...options...]
args:
service (optional) name of the service to forward locally
options:
--context override context
--namespace override namespace
--subsession kube.redis subsession (default 0)
to show a required password on screen, use both:
--password-secret Secret resource
--password-key key within Secret's 'data'
-h, --help show this dialogue and exit
"
local CONTEXT NAMESPACE SERVICE
local SUBSESSION=0
while [[ $# -gt 0 ]]
do
case $1 in
--context ) CONTEXT=$2; shift 1 ;;
--namespace ) NAMESPACE=$2; shift 1 ;;
--subsession ) SUBSESSION=$2; shift 1 ;;
--password-secret ) PASSWORD_SECRET=$2; shift 1 ;;
--password-key ) PASSWORD_KEY=$2; shift 1 ;;
-h | --help ) utils.io.usage; return 0 ;;
* )
[ $SERVICE ] && echo.error "unexpected argument '$2'"
SERVICE=$1
;;
esac
shift 1
done
utils.check-errors --fail
kube.kubectl.serve
}