50 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/zsh
 | 
						|
use kubectl --group kubectl
 | 
						|
#####################################################################
 | 
						|
 | 
						|
MAIN() {
 | 
						|
	local USAGE="
 | 
						|
	usage: [service] [...options...]
 | 
						|
 | 
						|
	args:
 | 
						|
	  service   (optional) name of the service to forward locally
 | 
						|
 | 
						|
	options:
 | 
						|
	  --context      override context
 | 
						|
	  --namespace    override namespace
 | 
						|
	  --subsession   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 ) USAGE; return 0 ;;
 | 
						|
 | 
						|
			* )
 | 
						|
				[ $SERVICE ] && ERROR "unexpected argument '$2'"
 | 
						|
				SERVICE=$1
 | 
						|
				;;
 | 
						|
		esac
 | 
						|
		shift 1
 | 
						|
	done
 | 
						|
 | 
						|
	CHECK_ERRORS
 | 
						|
 | 
						|
	KUBECTL__SERVE 
 | 
						|
}
 |