Commit 08d4197d authored by Carlos Natalino's avatar Carlos Natalino
Browse files

Changes to the deploy and webui yaml to accommodate the new metrics collection framework

parent a742df66
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -241,7 +241,8 @@ for COMPONENT in $TFS_COMPONENTS; do

    echo "  Adapting '$COMPONENT' manifest file..."
    MANIFEST="$TMP_MANIFESTS_FOLDER/${COMPONENT}service.yaml"
    cp ./manifests/"${COMPONENT}"service.yaml "$MANIFEST"
    # 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')
@@ -328,14 +329,19 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]]; then
    echo "Configuring WebUI DataStores and Dashboards..."
    sleep 5

    INGRESS_CTRL_NAME=$(echo "${TFS_K8S_NAMESPACE}" | sed "s/tfs/nginx-ingress-microk8s-controller/g")
    EXT_HTTP_PORT=$(kubectl get daemonsets.apps --namespace ingress ${INGRESS_CTRL_NAME} \
        -o 'jsonpath={.spec.template.spec.containers[?(@.name=="nginx-ingress-microk8s")].ports[?(@.name=="http")].hostPort}')
    # INGRESS_CTRL_NAME=$(echo "${TFS_K8S_NAMESPACE}" | sed "s/tfs/nginx-ingress-microk8s-controller/g")
    # EXT_HTTP_PORT=$(kubectl get daemonsets.apps --namespace ingress ${INGRESS_CTRL_NAME} \
    #     -o 'jsonpath={.spec.template.spec.containers[?(@.name=="nginx-ingress-microk8s")].ports[?(@.name=="http")].hostPort}')
    
    # get IP and port of grafana in the `monitoring` namespace
    GRAFANA_IP=$(kubectl get service/grafana -n monitoring -o jsonpath='{.spec.clusterIP}')
    GRAFANA_PORT=3000 #$(kubectl get service webuiservice --namespace $TFS_K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}')

    # Exposed through the ingress controller "tfs-ingress"
    GRAFANA_URL="127.0.0.1:${EXT_HTTP_PORT}/grafana"
    # GRAFANA_URL="127.0.0.1:${EXT_HTTP_PORT}/grafana"
    GRAFANA_URL="${GRAFANA_IP}:${GRAFANA_PORT}"

    # Default Grafana credentials
    # Default Grafana credentials when installed with the `monitoring` addon
    GRAFANA_USERNAME="admin"
    GRAFANA_PASSWORD="admin"

+81 −0
Original line number Diff line number Diff line
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tfs-ingress
  namespace: tfs
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules:
  - http:
      paths:
        - path: /webui(/|$)(.*)
          pathType: Prefix
          backend:
            service:
              name: webuiservice
              port:
                number: 8004
        - path: /grafana(/|$)(.*)
          pathType: Prefix
          backend:
            service:
              name: webuiservice
              port:
                number: 3000
        #- path: /context(/|$)(.*)
        #  pathType: Prefix
        #  backend:
        #    service:
        #      name: contextservice
        #      port:
        #        number: 8080
        - path: /()(restconf/.*)
          pathType: Prefix
          backend:
            service:
              name: computeservice
              port:
                number: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: grafana-ingress
  namespace: monitoring
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/proxy-redirect-from: "/"
    nginx.ingress.kubernetes.io/proxy-redirect-to: "/newgrafana/"
spec:
  rules:
  - http:
      paths:
        - path: /newgrafana(/|$)(.*)
          pathType: Prefix
          backend:
            service:
              name: grafana
              port:
                number: 3000
        #- path: /context(/|$)(.*)
        #  pathType: Prefix
        #  backend:
        #    service:
        #      name: contextservice
        #      port:
        #        number: 8080
+0 −37
Original line number Diff line number Diff line
@@ -61,43 +61,6 @@ spec:
          limits:
            cpu: 500m
            memory: 512Mi
      - name: grafana
        image: grafana/grafana:8.5.11
        imagePullPolicy: IfNotPresent
        ports:
          - containerPort: 3000
            name: http-grafana
            protocol: TCP
        env:
        - name: GF_SERVER_ROOT_URL
          value: "http://0.0.0.0:3000/grafana/"
        - name: GF_SERVER_SERVE_FROM_SUB_PATH
          value: "true"
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /robots.txt
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 2
        livenessProbe:
          failureThreshold: 3
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 3000
          timeoutSeconds: 1
        resources:
          requests:
            cpu: 150m
            memory: 512Mi
          limits:
            cpu: 500m
            memory: 1024Mi
---
apiVersion: v1
kind: Service