From 9d9efa4ff02be32d8be2757d7d30a03f7adbe379 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Sun, 26 Mar 2023 11:59:33 +0000 Subject: [PATCH] Deploy Scripts: - Added linkerd injectors for load balancing (commented, not working) - Added service monitor to my_deploy.sh --- deploy/expose_perf_dashboards.sh | 20 ++++++++++++++++++++ deploy/tfs.sh | 1 + manifests/pathcompservice.yaml | 4 ++++ my_deploy.sh | 7 ++++--- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 deploy/expose_perf_dashboards.sh diff --git a/deploy/expose_perf_dashboards.sh b/deploy/expose_perf_dashboards.sh new file mode 100755 index 000000000..6cabbae95 --- /dev/null +++ b/deploy/expose_perf_dashboards.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +EXT_GRAFANA_HTTP_PORT="31001" +EXT_PROMETHEUS_HTTP_PORT="31002" + +GRAFANA_HTTP_PORT=$(kubectl --namespace monitoring get service grafana -o 'jsonpath={.spec.ports[?(@.name=="http")].port}') +PATCH='{"data": {"'${EXT_GRAFANA_HTTP_PORT}'": "monitoring/grafana:'${GRAFANA_HTTP_PORT}'"}}' +kubectl patch configmap nginx-ingress-tcp-microk8s-conf --namespace ingress --patch "${PATCH}" +PORT_MAP='{"containerPort": '${EXT_GRAFANA_HTTP_PORT}', "hostPort": '${EXT_GRAFANA_HTTP_PORT}'}' +CONTAINER='{"name": "nginx-ingress-microk8s", "ports": ['${PORT_MAP}']}' +PATCH='{"spec": {"template": {"spec": {"containers": ['${CONTAINER}']}}}}' +kubectl patch daemonset nginx-ingress-microk8s-controller --namespace ingress --patch "${PATCH}" + +PROMETHEUS_HTTP_PORT=$(kubectl --namespace monitoring get service prometheus-k8s -o 'jsonpath={.spec.ports[?(@.name=="web")].port}') +PATCH='{"data": {"'${EXT_PROMETHEUS_HTTP_PORT}'": "monitoring/prometheus-k8s:'${PROMETHEUS_HTTP_PORT}'"}}' +kubectl patch configmap nginx-ingress-tcp-microk8s-conf --namespace ingress --patch "${PATCH}" +PORT_MAP='{"containerPort": '${EXT_PROMETHEUS_HTTP_PORT}', "hostPort": '${EXT_PROMETHEUS_HTTP_PORT}'}' +CONTAINER='{"name": "nginx-ingress-microk8s", "ports": ['${PORT_MAP}']}' +PATCH='{"spec": {"template": {"spec": {"containers": ['${CONTAINER}']}}}}' +kubectl patch daemonset nginx-ingress-microk8s-controller --namespace ingress --patch "${PATCH}" diff --git a/deploy/tfs.sh b/deploy/tfs.sh index 4c6dc95d2..6a0e7a2e6 100755 --- a/deploy/tfs.sh +++ b/deploy/tfs.sh @@ -242,6 +242,7 @@ for COMPONENT in $TFS_COMPONENTS; do echo " Adapting '$COMPONENT' manifest file..." MANIFEST="$TMP_MANIFESTS_FOLDER/${COMPONENT}service.yaml" cp ./manifests/"${COMPONENT}"service.yaml "$MANIFEST" + #cat ./manifests/"${COMPONENT}"service.yaml | linkerd inject - --proxy-cpu-request "10m" --proxy-cpu-limit "1" --proxy-memory-request "64Mi" --proxy-memory-limit "256Mi" > "$MANIFEST" if [ "$COMPONENT" == "pathcomp" ]; then IMAGE_URL=$(echo "$TFS_REGISTRY_IMAGES/$COMPONENT-frontend:$TFS_IMAGE_TAG" | sed 's,//,/,g' | sed 's,http:/,,g') diff --git a/manifests/pathcompservice.yaml b/manifests/pathcompservice.yaml index fd3599f42..28edf9aa5 100644 --- a/manifests/pathcompservice.yaml +++ b/manifests/pathcompservice.yaml @@ -23,6 +23,8 @@ spec: replicas: 1 template: metadata: + #annotations: + # config.linkerd.io/opaque-ports: "8081" labels: app: pathcompservice spec: @@ -53,6 +55,8 @@ spec: - name: backend image: labs.etsi.org:5050/tfs/controller/pathcomp-backend:latest imagePullPolicy: Always + #ports: + #- containerPort: 8081 #readinessProbe: # httpGet: # path: /health diff --git a/my_deploy.sh b/my_deploy.sh index 22a7ae815..4f3cb25f6 100755 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -20,7 +20,8 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. -export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui load_generator" +#automation monitoring compute +export TFS_COMPONENTS="context device pathcomp service slice webui load_generator" # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" @@ -29,7 +30,7 @@ export TFS_IMAGE_TAG="dev" export TFS_K8S_NAMESPACE="tfs" # Set additional manifest files to be applied after the deployment -export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml" +export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml manifests/servicemonitors.yaml" # Set the new Grafana admin password export TFS_GRAFANA_PASSWORD="admin123+" @@ -63,7 +64,7 @@ export CRDB_DATABASE="tfs" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. -export CRDB_DROP_DATABASE_IF_EXISTS="" +export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="" -- GitLab