summaryrefslogtreecommitdiffstats
path: root/kubernetes/portal/launch-onap-portal.sh
diff options
context:
space:
mode:
authorMandeep Khinda <mandeep.khinda@amdocs.com>2018-04-26 14:35:38 +0000
committerMandeep Khinda <mandeep.khinda@amdocs.com>2018-04-27 18:37:44 +0000
commitf8b8f07b9e7fa70ecc92b9016fabcfc0ba53e189 (patch)
treec5aaad57a641fca5c83a96a5f590c134d7fae114 /kubernetes/portal/launch-onap-portal.sh
parent4fd46645b88f571108341c3c2192269daa9cdd46 (diff)
OOM direct portal access
-must include suffix of "onap.org" in URL for single signon -this isn't truly configurable - portal-app needs to be rebuilt See: portal/docs/tutorials/portal-sdk/single-signon.rst -must update local etc hosts with "fake" dns names -must use kubectl to portforward application ports into the pods -fixed zookeeper service name, -this is needed to be able to login (auth) -adding helper script to launch port-forwarding Issue-ID: OOM-633 Change-Id: I019f33f71a673467c420d1e44ee6c42da4a95f4b Signed-off-by: Mandeep Khinda <mandeep.khinda@amdocs.com>
Diffstat (limited to 'kubernetes/portal/launch-onap-portal.sh')
-rwxr-xr-xkubernetes/portal/launch-onap-portal.sh70
1 files changed, 70 insertions, 0 deletions
diff --git a/kubernetes/portal/launch-onap-portal.sh b/kubernetes/portal/launch-onap-portal.sh
new file mode 100755
index 0000000000..d9f64c121b
--- /dev/null
+++ b/kubernetes/portal/launch-onap-portal.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+usage () { echo "Usage : $0 <namespace> <helm release name>"; }
+
+READY_JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
+
+NAMESPACE=$1
+RELEASE_NAME=$2
+
+if [ ! "$NAMESPACE" ] || [ ! "$RELEASE_NAME" ]
+then
+ usage
+ exit 1
+fi
+
+PORTAL_POD_NAME=`kubectl get pods --namespace $NAMESPACE --selector=app=portal-app,release=$RELEASE_NAME \
+-o jsonpath='{.items[*].metadata.name}' -o jsonpath="$READY_JSONPATH" | grep "Ready=True"|awk -F: '{print $1}' `
+SDC_POD_NAME=`kubectl get pods --namespace $NAMESPACE --selector=app=sdc-fe,release=$RELEASE_NAME \
+-o jsonpath='{.items[*].metadata.name}' -o jsonpath="$READY_JSONPATH" | grep "Ready=True" |awk -F: '{print $1}'`
+VID_POD_NAME=`kubectl get pods --namespace $NAMESPACE --selector=app=vid,release=$RELEASE_NAME \
+-o jsonpath='{.items[*].metadata.name}' -o jsonpath="$READY_JSONPATH" | grep "Ready=True" |awk -F: '{print $1}'`
+POLICY_POD_NAME=`kubectl get pods --namespace $NAMESPACE --selector=app=pap,release=$RELEASE_NAME \
+-o jsonpath='{.items[*].metadata.name}' -o jsonpath="$READY_JSONPATH" | grep "Ready=True" |awk -F: '{print $1}'`
+PORTALSDK_POD_NAME=`kubectl get pods --namespace $NAMESPACE --selector=app=portal-sdk,release=$RELEASE_NAME \
+-o jsonpath='{.items[*].metadata.name}' -o jsonpath="$READY_JSONPATH" | grep "Ready=True" |awk -F: '{print $1}'`
+
+#TODO: Add more as testing progresses
+[[ -z "$PORTAL_POD_NAME" ]] && { echo "WARNING: portal-app is not running in your Kubernetes cluster"; }
+[[ -z "$SDC_POD_NAME" ]] && { echo "WARNING: sdc-fe is not running in your Kubernetes cluster"; }
+[[ -z "$VID_POD_NAME" ]] && { echo "WARNING: vid is not running in your Kubernetes cluster"; }
+[[ -z "$POLICY_POD_NAME" ]] && { echo "WARNING: pap is not running in your Kubernetes cluster"; }
+[[ -z "$PORTALSDK_POD_NAME" ]] && { echo "WARNING: portal-sdk is not running in your Kubernetes cluster"; }
+
+if [ ! -z "$PORTAL_POD_NAME" ]
+then
+ kubectl -n $NAMESPACE port-forward "$PORTAL_POD_NAME" 8989:8080 &
+ PORTAL_PID=$!
+fi
+
+if [ ! -z "$VID_POD_NAME" ]
+then
+ kubectl -n $NAMESPACE port-forward "$VID_POD_NAME" 8080:8080 &
+ VID_PID=$!
+fi
+
+if [ ! -z "$SDC_POD_NAME" ]
+then
+ kubectl -n $NAMESPACE port-forward "$SDC_POD_NAME" 8181:8181 &
+ SDC_PID=$!
+fi
+
+if [ ! -z "$POLICY_POD_NAME" ]
+then
+ kubectl -n $NAMESPACE port-forward "$POLICY_POD_NAME" 8443:8443 &
+ POLICY_PID=$!
+fi
+
+if [ ! -z "$PORTALSDK_POD_NAME" ]
+then
+ kubectl -n $NAMESPACE port-forward "$PORTALSDK_POD_NAME" 8990:8080 &
+ PORTALSDK_PID=$!
+fi
+
+trap "{ kill -9 $PORTAL_PID $VID_PID $SDC_PID $POLICY_PID $PORTALSDK_PID; exit 0; }" INT
+echo -e $'Press Ctrl+C to exit...\n'
+
+while :
+do
+ sleep 60
+done \ No newline at end of file