# this script opens the webui

WEBUI_SERVICE_NAME="service/webuiservice-public"
WEBUI_PROTO=`kubectl get ${WEBUI_SERVICE_NAME} -n tf-dev -o jsonpath='{.spec.ports[0].name}'`
WEBUI_IP=`kubectl get ${WEBUI_SERVICE_NAME} -n tf-dev -o jsonpath='{.spec.clusterIP}'`
WEBUI_PORT=`kubectl get ${WEBUI_SERVICE_NAME} -n tf-dev -o jsonpath='{.spec.ports[0].port}'`
GRAFANA_PORT=`kubectl get ${WEBUI_SERVICE_NAME} -n tf-dev -o jsonpath='{.spec.ports[1].port}'`
URL=${WEBUI_PROTO}://${WEBUI_IP}:${WEBUI_PORT}

echo Opening web UI on URL ${URL}

# curl -kL ${URL}

python3 -m webbrowser ${URL}

URL=${WEBUI_PROTO}://${WEBUI_IP}:${GRAFANA_PORT}

echo Opening web UI on URL ${URL}

# curl -kL ${URL}

python3 -m webbrowser ${URL}
