Commit 77159a62 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/343-integration-of-mimir-deployment-in-production-environment' into 'develop'

Resolve "Integration of Mimir Deployment in Production Environment"

See merge request !401
parents bbf9dba5 6ba95b23
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -213,6 +213,23 @@ export QDB_DROP_TABLES_IF_EXIST=${QDB_DROP_TABLES_IF_EXIST:-""}
export QDB_REDEPLOY=${QDB_REDEPLOY:-""}


# ----- Time Series Storage - Prometheus / Grafana Mimir -----------------------

# If not already set, set Time Series Storage installation mode. Accepted values are:
# 'single' and 'cluster'.
# - If TSDB_DEPLOY_MODE is "single", Time Series Storage is deployed in single node
#   mode and features a basic Prometheus instance. It is convenient for development and
#   testing purposes and should fit in a VM.
#   IT SHOULD NOT BE USED IN PRODUCTION ENVIRONMENTS.
# - If TSDB_DEPLOY_MODE is "cluster", Time Series Storage is deployed in cluster mode
#   and a Grafana Mimir database in cluster mode will be deployed. It is convenient for
#   production and provides scalability features. If you are deploying for production,
#   also read the following link providing details on deploying Grafana Mimir for
#   production environments:
#   Ref: https://grafana.com/docs/mimir/latest/manage/run-production-environment/
export TSDB_DEPLOY_MODE=${TSDB_DEPLOY_MODE:-"single"}


# ----- K8s Observability ------------------------------------------------------

# If not already set, set the external port Prometheus Mgmt HTTP GUI interface will be exposed to.
+36 −15
Original line number Diff line number Diff line
@@ -15,6 +15,24 @@

set -euo pipefail


# ----- Time Series Storage - Prometheus / Grafana Mimir -----------------------

# If not already set, set Time Series Storage installation mode. Accepted values are:
# 'single' and 'cluster'.
# - If TSDB_DEPLOY_MODE is "single", Time Series Storage is deployed in single node
#   mode and features a basic Prometheus instance. It is convenient for development and
#   testing purposes and should fit in a VM.
#   IT SHOULD NOT BE USED IN PRODUCTION ENVIRONMENTS.
# - If TSDB_DEPLOY_MODE is "cluster", Time Series Storage is deployed in cluster mode
#   and a Grafana Mimir database in cluster mode will be deployed. It is convenient for
#   production and provides scalability features. If you are deploying for production,
#   also read the following link providing details on deploying Grafana Mimir for
#   production environments:
#   Ref: https://grafana.com/docs/mimir/latest/manage/run-production-environment/
export TSDB_DEPLOY_MODE=${TSDB_DEPLOY_MODE:-"single"}


# -----------------------------------------------------------
# Global namespace for all deployments
# -----------------------------------------------------------
@@ -33,11 +51,11 @@ VALUES_FILE_PROM="$VALUES_FILE_PATH/prometheus_values.yaml"
# -----------------------------------------------------------
# Mimir Configuration
# -----------------------------------------------------------
# RELEASE_NAME_MIMIR="mon-mimir"
# CHART_REPO_NAME_MIMIR="grafana"
# CHART_REPO_URL_MIMIR="https://grafana.github.io/helm-charts"
# CHART_NAME_MIMIR="mimir-distributed"
# VALUES_FILE_MIMIR="$VALUES_FILE_PATH/mimir_values.yaml"
RELEASE_NAME_MIMIR="mon-mimir"
CHART_REPO_NAME_MIMIR="grafana"
CHART_REPO_URL_MIMIR="https://grafana.github.io/helm-charts"
CHART_NAME_MIMIR="mimir-distributed"
VALUES_FILE_MIMIR="$VALUES_FILE_PATH/mimir_values.yaml"

# -----------------------------------------------------------
# Grafana Configuration
@@ -105,16 +123,19 @@ kubectl rollout status deployment/"$RELEASE_NAME_PROM-server" -n "$NAMESPACE" ||


# 2) Deploy Mimir
# deploy_chart "$RELEASE_NAME_MIMIR" \
#              "$CHART_REPO_NAME_MIMIR" \
#              "$CHART_REPO_URL_MIMIR" \
#              "$CHART_NAME_MIMIR" \
#              "$VALUES_FILE_MIMIR" \
#              "$NAMESPACE"
if [ "$TSDB_DEPLOY_MODE" == "cluster" ]; then
    echo "Deploying Mimir in production mode."
    # You can add any production-specific configurations here if needed
    deploy_chart "$RELEASE_NAME_MIMIR" \
                "$CHART_REPO_NAME_MIMIR" \
                "$CHART_REPO_URL_MIMIR" \
                "$CHART_NAME_MIMIR" \
                "$VALUES_FILE_MIMIR" \
                "$NAMESPACE"

# Depending on how Mimir runs (StatefulSets, Deployments), you can wait for
# the correct resource to be ready. For example:
# kubectl rollout status statefulset/"$RELEASE_NAME_MIMIR-distributor" -n "$NAMESPACE" || true
    # you can wait for the resource to be ready.
    kubectl rollout status statefulset/"$RELEASE_NAME_MIMIR-distributor" -n "$NAMESPACE" || true
fi


# 3) Deploy Grafana
+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ datasources:
     isDefault: true
   - name: Mimir
     type: prometheus
     url: http://mimir-nginx.mon-mimir.svc:80/prometheus
     url: http://mon-mimir-gateway.monitoring.svc.cluster.local/prometheus
     access: proxy
     isDefault: false

+132 −0
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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.
# Minimal Mimir for lab/PoC using single-binary and in-cluster MinIO.
# Chart: grafana/mimir-distributed

global:
  # -- Definitions to set up nginx resolver
  dnsService: kube-dns
  dnsNamespace: kube-system
  clusterDomain: cluster.local.
  dnsConfig: {}

# Mimir structured configuration. Wires storage to the in-cluster MinIO.
mimir:
  structuredConfig:
    common:
      storage:
        backend: s3
        s3:
          endpoint: minio:9000
          access_key_id: grafana-mimir
          secret_access_key: supersecret   # change in real clusters
          insecure: true
    blocks_storage:
      s3:
        bucket_name: mimir-tsdb
    ruler_storage:
      s3:
        bucket_name: mimir-ruler
    alertmanager_storage:
      s3:
        bucket_name: mimir-alertmanager

minio:
  enabled: true
  mode: standalone
  rootUser: grafana-mimir
  rootPassword: supersecret             # change in real clusters
  buckets:
    - name: mimir-tsdb
      policy: none
      purge: false
    - name: mimir-ruler
      policy: none
      purge: false
    - name: mimir-alertmanager
      policy: none
      purge: false
  persistence:
    enabled: true
    size: 10Gi
  resources:
    requests:
      cpu: 100m
      memory: 128Mi

# Disable embedded Kafka. Not needed for this minimal setup.
kafka:
  enabled: false

# Keep the NGINX gateway internal to the cluster for simplicity.
gateway:
  enabled: true
  replicas: 1
  service:
    type: ClusterIP
    port: 80
  nginx:
    verboseLogging: true
  resources:
    requests:
      cpu: 100m
      memory: 128Mi
    limits:
      cpu: 500m
      memory: 512Mi

# Turn off sharded components. singleBinary runs the core services already.
distributor:
  replicas: 0
ingester:
  replicas: 0
querier:
  replicas: 0
query_frontend:
  replicas: 0
query_scheduler:
  replicas: 0
store_gateway:
  replicas: 0
compactor:
  replicas: 0

# Optional features disabled for minimum footprint.
ruler:
  enabled: false
alertmanager:
  enabled: false
overrides_exporter:
  enabled: false

# Caches off for minimal footprint. Enable later if you need performance.
memcached:
  enabled: false
memcached-queries:
  enabled: false
memcached-metadata:
  enabled: false
memcached-results:
  enabled: false

# Meta-monitoring off to keep footprint small. Turn on when you add Prometheus.
metaMonitoring:
  dashboards:
    enabled: false
  serviceMonitor:
    enabled: false
  prometheusRule:
    enabled: false
  grafanaAgent:
    enabled: false
+8 −0
Original line number Diff line number Diff line
@@ -217,6 +217,14 @@ export QDB_DROP_TABLES_IF_EXIST=""
export QDB_REDEPLOY=""


# ----- Time Series Storage - Prometheus / Grafana Mimir -----------------------

# Set Time Series Storage installation mode to 'single' (i.e., Prometheus only).
# This option is convenient for development and testing. See ./deploy/all.sh or
# ./deploy/monitoring.sh for additional details.
export TSDB_DEPLOY_MODE="single"


# ----- K8s Observability ------------------------------------------------------

# Set the external port Prometheus Mgmt HTTP GUI interface will be exposed to.