Loading configure_dashboards.sh +4 −4 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ export INFLUXDB_PASSWORD=$(kubectl --namespace $K8S_NAMESPACE get secrets influx export INFLUXDB_DATABASE=$(kubectl --namespace $K8S_NAMESPACE get secrets influxdb-secrets -o jsonpath='{.data.INFLUXDB_DB}' | base64 --decode) export INFLUXDB_URL="http://${INFLUXDB_HOSTNAME}:${INFLUXDB_PORT}" export GRAFANA_HOSTNAME=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') export GRAFANA_HOSTNAME=$(kubectl get node $K8S_HOSTNAME --namespace $K8S_NAMESPACE -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') export GRAFANA_PORT=$(kubectl get service webuiservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}') export GRAFANA_USERNAME="admin" export GRAFANA_PASSWORD="admin123+" Loading @@ -22,8 +22,8 @@ echo ${GRAFANA_URL}/api/datasources # Create InfluxDB DataSource # Ref: https://grafana.com/docs/grafana/latest/http_api/data_source/ curl -X POST -H "Content-Type: application/json" -d '{ "type" : "influxdb", curl -H "Content-Type: application/json" -d '{ "type" : "influxdb",bbbbb "name" : "InfluxDB", "url" : "'"$INFLUXDB_URL"'", "access" : "proxy", Loading @@ -37,7 +37,7 @@ echo # Create Monitoring Dashboard # Ref: https://grafana.com/docs/grafana/latest/http_api/dashboard/ curl -X POST -H "Content-Type: application/json" \ curl -H "Content-Type: application/json" \ -d '@src/webui/grafana_dashboard.json' \ ${GRAFANA_URL}/api/dashboards/db echo deploy_in_kubernetes.sh +4 −1 Original line number Diff line number Diff line Loading @@ -83,11 +83,14 @@ for COMPONENT in $COMPONENTS; do fi echo " Deploying '$COMPONENT' component to Kubernetes..." DEPLOY_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}.log" DEPLOY_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}.ddlog" kubectl --namespace $K8S_NAMESPACE apply -f "$MANIFEST" > "$DEPLOY_LOG" printf "\n" done # line for the OFC demo kubectl --namespace $K8S_NAMESPACE apply -f manifest/expose_services.yaml kubectl --namespace $K8S_NAMESPACE get all echo "Done!" No newline at end of file manifests/expose_services.yaml 0 → 100644 +90 −0 Original line number Diff line number Diff line --- apiVersion: v1 kind: Service metadata: name: contextservice-public labels: app: contextservice spec: type: NodePort selector: app: contextservice ports: - name: grpc protocol: TCP port: 1010 targetPort: 1010 - name: http protocol: TCP port: 8080 targetPort: 8080 nodePort: 30808 --- apiVersion: v1 kind: Service metadata: name: redis-tests labels: app: contextservice spec: type: NodePort selector: app: contextservice ports: - name: redis protocol: TCP port: 6379 targetPort: 6379 --- apiVersion: v1 kind: Service metadata: name: influx-tests labels: app: monitoringservice spec: type: NodePort selector: app: monitoringservice ports: - name: influx protocol: TCP port: 8086 targetPort: 8086 --- apiVersion: v1 kind: Service metadata: name: deviceservice-public labels: app: deviceservice spec: type: NodePort selector: app: deviceservice ports: - name: grpc protocol: TCP port: 2020 targetPort: 2020 --- apiVersion: v1 kind: Service metadata: name: computeservice-public labels: app: computeservice spec: type: NodePort selector: app: computeservice ports: - name: http protocol: TCP port: 8080 targetPort: 8080 - name: grpc protocol: TCP port: 9090 targetPort: 9090 --- No newline at end of file manifests/webuiservice.yaml +5 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,11 @@ spec: - name: http port: 8004 targetPort: 8004 - name: grafana protocol: TCP port: 3000 targetPort: 3000 nodePort: 30300 --- apiVersion: v1 kind: Service Loading open_webui.sh +14 −4 Original line number Diff line number Diff line # this script opens the webui WEBUI_PROTO=`kubectl get service/webuiservice -n tf-dev -o jsonpath='{.spec.ports[0].name}'` WEBUI_IP=`kubectl get service/webuiservice -n tf-dev -o jsonpath='{.spec.clusterIP}'` WEBUI_PORT=`kubectl get service/webuiservice -n tf-dev -o jsonpath='{.spec.ports[0].port}'` 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} Loading @@ -10,3 +12,11 @@ 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} Loading
configure_dashboards.sh +4 −4 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ export INFLUXDB_PASSWORD=$(kubectl --namespace $K8S_NAMESPACE get secrets influx export INFLUXDB_DATABASE=$(kubectl --namespace $K8S_NAMESPACE get secrets influxdb-secrets -o jsonpath='{.data.INFLUXDB_DB}' | base64 --decode) export INFLUXDB_URL="http://${INFLUXDB_HOSTNAME}:${INFLUXDB_PORT}" export GRAFANA_HOSTNAME=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') export GRAFANA_HOSTNAME=$(kubectl get node $K8S_HOSTNAME --namespace $K8S_NAMESPACE -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') export GRAFANA_PORT=$(kubectl get service webuiservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}') export GRAFANA_USERNAME="admin" export GRAFANA_PASSWORD="admin123+" Loading @@ -22,8 +22,8 @@ echo ${GRAFANA_URL}/api/datasources # Create InfluxDB DataSource # Ref: https://grafana.com/docs/grafana/latest/http_api/data_source/ curl -X POST -H "Content-Type: application/json" -d '{ "type" : "influxdb", curl -H "Content-Type: application/json" -d '{ "type" : "influxdb",bbbbb "name" : "InfluxDB", "url" : "'"$INFLUXDB_URL"'", "access" : "proxy", Loading @@ -37,7 +37,7 @@ echo # Create Monitoring Dashboard # Ref: https://grafana.com/docs/grafana/latest/http_api/dashboard/ curl -X POST -H "Content-Type: application/json" \ curl -H "Content-Type: application/json" \ -d '@src/webui/grafana_dashboard.json' \ ${GRAFANA_URL}/api/dashboards/db echo
deploy_in_kubernetes.sh +4 −1 Original line number Diff line number Diff line Loading @@ -83,11 +83,14 @@ for COMPONENT in $COMPONENTS; do fi echo " Deploying '$COMPONENT' component to Kubernetes..." DEPLOY_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}.log" DEPLOY_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}.ddlog" kubectl --namespace $K8S_NAMESPACE apply -f "$MANIFEST" > "$DEPLOY_LOG" printf "\n" done # line for the OFC demo kubectl --namespace $K8S_NAMESPACE apply -f manifest/expose_services.yaml kubectl --namespace $K8S_NAMESPACE get all echo "Done!" No newline at end of file
manifests/expose_services.yaml 0 → 100644 +90 −0 Original line number Diff line number Diff line --- apiVersion: v1 kind: Service metadata: name: contextservice-public labels: app: contextservice spec: type: NodePort selector: app: contextservice ports: - name: grpc protocol: TCP port: 1010 targetPort: 1010 - name: http protocol: TCP port: 8080 targetPort: 8080 nodePort: 30808 --- apiVersion: v1 kind: Service metadata: name: redis-tests labels: app: contextservice spec: type: NodePort selector: app: contextservice ports: - name: redis protocol: TCP port: 6379 targetPort: 6379 --- apiVersion: v1 kind: Service metadata: name: influx-tests labels: app: monitoringservice spec: type: NodePort selector: app: monitoringservice ports: - name: influx protocol: TCP port: 8086 targetPort: 8086 --- apiVersion: v1 kind: Service metadata: name: deviceservice-public labels: app: deviceservice spec: type: NodePort selector: app: deviceservice ports: - name: grpc protocol: TCP port: 2020 targetPort: 2020 --- apiVersion: v1 kind: Service metadata: name: computeservice-public labels: app: computeservice spec: type: NodePort selector: app: computeservice ports: - name: http protocol: TCP port: 8080 targetPort: 8080 - name: grpc protocol: TCP port: 9090 targetPort: 9090 --- No newline at end of file
manifests/webuiservice.yaml +5 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,11 @@ spec: - name: http port: 8004 targetPort: 8004 - name: grafana protocol: TCP port: 3000 targetPort: 3000 nodePort: 30300 --- apiVersion: v1 kind: Service Loading
open_webui.sh +14 −4 Original line number Diff line number Diff line # this script opens the webui WEBUI_PROTO=`kubectl get service/webuiservice -n tf-dev -o jsonpath='{.spec.ports[0].name}'` WEBUI_IP=`kubectl get service/webuiservice -n tf-dev -o jsonpath='{.spec.clusterIP}'` WEBUI_PORT=`kubectl get service/webuiservice -n tf-dev -o jsonpath='{.spec.ports[0].port}'` 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} Loading @@ -10,3 +12,11 @@ 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}