2021-12-08 07:56:58 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
host=$1
|
|
|
|
namespace=$2
|
|
|
|
|
|
|
|
if [ "x$host" == "x" ]
|
|
|
|
then
|
|
|
|
echo "Please give host of kubernetes master as argument. Optionally a
|
|
|
|
namespace can be provided. This defaults to 'stackspin'"
|
|
|
|
echo " "
|
|
|
|
echo $0 hostname [namespace]
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "x$namespace" == "x" ]
|
|
|
|
then
|
|
|
|
namespace="stackspin"
|
|
|
|
fi
|
|
|
|
|
|
|
|
admin=`ssh $host -lroot kubectl get service -n $namespace |grep single-sign-on-kratos-admin | awk '{print $3'}`
|
|
|
|
public=`ssh $host -lroot kubectl get service -n $namespace |grep single-sign-on-kratos-public | awk '{print $3}'`
|
|
|
|
hydra=`ssh $host -lroot kubectl get service -n $namespace |grep single-sign-on-hydra-admin | awk '{print $3}'`
|
2022-03-22 07:16:53 +01:00
|
|
|
mysql=`ssh $host -lroot kubectl get service -n $namespace |grep single-sign-on-database-maria|grep -v headless | awk '{print $3}'`
|
2021-12-08 07:56:58 +01:00
|
|
|
|
|
|
|
|
2022-03-22 07:16:53 +01:00
|
|
|
if [ "x$admin" == 'x' ] || [ "x$public" == 'x' ] || [ "x$hydra" == 'x' ] || [ "x$mysql" == 'x' ]
|
2021-12-08 07:56:58 +01:00
|
|
|
then
|
|
|
|
echo "It seems we where not able find at least one of the remote services"
|
|
|
|
echo " please make sure that kubectl use the right namespace by default."
|
|
|
|
echo " normally this is 'stackspin'. If you use a different namespace"
|
|
|
|
echo " please provide this as second argument"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "
|
|
|
|
kratos admin port will be at localhost: 8000
|
|
|
|
kratos public port will be at localhost: 8080
|
|
|
|
hydra admin port will be at localhost: 4445
|
2022-03-22 07:16:53 +01:00
|
|
|
mysql port will be at localhost: 3306
|
2021-12-08 07:56:58 +01:00
|
|
|
"
|
|
|
|
|
2022-03-22 07:16:53 +01:00
|
|
|
ssh -L 8000:$admin:80 -L 8080:$public:80 -L 4445:$hydra:4445 -L 3306:$mysql:3306 root@$host
|