Commit 9d9efa4f authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Deploy Scripts:

- Added linkerd injectors for load balancing (commented, not working)
- Added service monitor to my_deploy.sh
parent 179d28fb
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
#!/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}"
+1 −0
Original line number Diff line number Diff line
@@ -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')
+4 −0
Original line number Diff line number Diff line
@@ -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
+4 −3
Original line number Diff line number Diff line
@@ -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=""