2023-08-29 00:42:38 +00:00
|
|
|
#!/bin/zsh
|
|
|
|
#####################################################################
|
|
|
|
DEPENDENCIES+=()
|
|
|
|
REQUIRED_ENV+=()
|
|
|
|
|
|
|
|
use kubectl --group kubectl
|
|
|
|
|
|
|
|
CHECK_ENVIRONMENT
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
MAIN() {
|
|
|
|
local USAGE="
|
2023-08-30 23:26:13 +00:00
|
|
|
usage: [namespace] [...options...]
|
2023-08-29 00:42:38 +00:00
|
|
|
|
|
|
|
args:
|
2023-08-30 23:26:13 +00:00
|
|
|
namespace (optional) the full name of the namespace context to set
|
|
|
|
|
|
|
|
options:
|
|
|
|
--subsession REDIS subsession (default 0)
|
2023-08-29 00:42:38 +00:00
|
|
|
"
|
2023-08-30 23:26:13 +00:00
|
|
|
local NAMESPACE
|
|
|
|
local SUBSESSION=0
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]
|
|
|
|
do
|
|
|
|
case $1 in
|
|
|
|
--subsession ) SUBSESSION=$2; shift 1 ;;
|
|
|
|
|
|
|
|
* )
|
|
|
|
[ $NAMESPACE ] && ERROR "unexpected argument '$2'"
|
|
|
|
NAMESPACE=$1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift 1
|
|
|
|
done
|
|
|
|
|
|
|
|
[ $NAMESPACE ] || NAMESPACE=$(KUBECTL__SELECT_NAMESPACE)
|
2023-08-29 00:42:38 +00:00
|
|
|
[ $NAMESPACE ] || ERROR 'must provide or select a valid namespace'
|
|
|
|
|
|
|
|
CHECK_ERRORS
|
|
|
|
|
|
|
|
KUBECTL__SET_NAMESPACE $NAMESPACE
|
|
|
|
}
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
MAIN $@
|