#/bin/bash

# this script opens the dashboard

K8S_NAMESPACE=${K8S_NAMESPACE:-'tf-dev'}

GRAFANA_IP=`kubectl get service/webuiservice -n ${K8S_NAMESPACE} -o jsonpath='{.spec.clusterIP}'`
GRAFANA_PORT=`kubectl get service/webuiservice -n ${K8S_NAMESPACE} -o jsonpath='{.spec.ports[1].port}'`
URL=http://${GRAFANA_IP}:${GRAFANA_PORT}

echo Opening Dashboard on URL ${URL}

# curl -kL ${URL}

python3 -m webbrowser ${URL}
