Files
scwrypts/plugins/kube/serve
T

50 lines
1.1 KiB
Bash
Raw Normal View History

2024-05-10 13:32:02 -06:00
#!/usr/bin/env zsh
use kubectl --group kube
2023-11-22 15:54:16 -07:00
#####################################################################
MAIN() {
local USAGE="
usage: [service] [...options...]
args:
service (optional) name of the service to forward locally
options:
--context override context
--namespace override namespace
2024-05-10 13:32:02 -06:00
--subsession kube.redis subsession (default 0)
2023-11-22 15:54:16 -07:00
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 ;;
2024-05-10 13:32:02 -06:00
-h | --help ) utils.io.usage; return 0 ;;
2023-11-22 15:54:16 -07:00
* )
2024-05-10 13:32:02 -06:00
[ $SERVICE ] && echo.error "unexpected argument '$2'"
2023-11-22 15:54:16 -07:00
SERVICE=$1
;;
esac
shift 1
done
2024-05-10 13:32:02 -06:00
utils.check-errors --fail
2023-11-22 15:54:16 -07:00
2024-05-10 13:32:02 -06:00
kube.kubectl.serve
2023-11-22 15:54:16 -07:00
}