From 16abc1ba3e435f1a962af724a2caf06830dcb2bc Mon Sep 17 00:00:00 2001 From: Waleed Akbar Date: Mon, 3 Nov 2025 15:27:57 +0000 Subject: [PATCH 1/3] Add production deployment support and Mimir configuration updates - Introduced TFS_DEPLOY_PRODUCTION environment variable for production deployments in monitoring.sh and my_deploy.sh. - Updated Mimir configuration in grafana_values.yaml to use the correct service URL. - Added mimir_values.yaml configuration file for deployment. --- deploy/monitoring.sh | 37 ++++--- manifests/monitoring/grafana_values.yaml | 2 +- manifests/monitoring/mimir_values.yaml | 132 +++++++++++++++++++++++ my_deploy.sh | 2 + 4 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 manifests/monitoring/mimir_values.yaml diff --git a/deploy/monitoring.sh b/deploy/monitoring.sh index c83d331e8..7b29eb48f 100755 --- a/deploy/monitoring.sh +++ b/deploy/monitoring.sh @@ -15,6 +15,9 @@ set -euo pipefail +# Deploy TFS in production environment +export TFS_DEPLOY_PRODUCTION=${TFS_DEPLOY_PRODUCTION:-""} + # ----------------------------------------------------------- # Global namespace for all deployments # ----------------------------------------------------------- @@ -33,11 +36,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 +108,20 @@ 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" - -# 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 +if [ "$TFS_DEPLOY_PRODUCTION" == "YES" ]; 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 +fi # 3) Deploy Grafana diff --git a/manifests/monitoring/grafana_values.yaml b/manifests/monitoring/grafana_values.yaml index 075760306..630fd7ef9 100644 --- a/manifests/monitoring/grafana_values.yaml +++ b/manifests/monitoring/grafana_values.yaml @@ -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 diff --git a/manifests/monitoring/mimir_values.yaml b/manifests/monitoring/mimir_values.yaml new file mode 100644 index 000000000..c7fa5bf94 --- /dev/null +++ b/manifests/monitoring/mimir_values.yaml @@ -0,0 +1,132 @@ +# 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 diff --git a/my_deploy.sh b/my_deploy.sh index 86c1a86f4..fdaab4723 100644 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -117,6 +117,8 @@ export TFS_GRAFANA_PASSWORD="admin123+" # Disable skip-build flag to rebuild the Docker images. export TFS_SKIP_BUILD="" +# Deploy TFS in production environment +export TFS_DEPLOY_PRODUCTION="" # ----- CockroachDB ------------------------------------------------------------ -- GitLab From 86f9173c889133e2ea45dfb875df02ab0eeabb79 Mon Sep 17 00:00:00 2001 From: Waleed Akbar Date: Wed, 5 Nov 2025 09:07:08 +0000 Subject: [PATCH 2/3] Refactor deployment environment variables for consistency in monitoring scripts --- deploy/monitoring.sh | 7 +++---- my_deploy.sh | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/deploy/monitoring.sh b/deploy/monitoring.sh index 7b29eb48f..74b245684 100755 --- a/deploy/monitoring.sh +++ b/deploy/monitoring.sh @@ -16,7 +16,7 @@ set -euo pipefail # Deploy TFS in production environment -export TFS_DEPLOY_PRODUCTION=${TFS_DEPLOY_PRODUCTION:-""} +export DEPLOY_TSDB_MODE=${DEPLOY_TSDB_MODE:-""} # ----------------------------------------------------------- # Global namespace for all deployments @@ -108,7 +108,7 @@ kubectl rollout status deployment/"$RELEASE_NAME_PROM-server" -n "$NAMESPACE" || # 2) Deploy Mimir -if [ "$TFS_DEPLOY_PRODUCTION" == "YES" ]; then +if [ "$DEPLOY_TSDB_MODE" == "YES" ]; then echo "Deploying Mimir in production mode." # You can add any production-specific configurations here if needed deploy_chart "$RELEASE_NAME_MIMIR" \ @@ -118,8 +118,7 @@ if [ "$TFS_DEPLOY_PRODUCTION" == "YES" ]; then "$VALUES_FILE_MIMIR" \ "$NAMESPACE" - # Depending on how Mimir runs (StatefulSets, Deployments), you can wait for - # the correct resource to be ready. For example: + # you can wait for the resource to be ready. kubectl rollout status statefulset/"$RELEASE_NAME_MIMIR-distributor" -n "$NAMESPACE" || true fi diff --git a/my_deploy.sh b/my_deploy.sh index fdaab4723..7fd34d2f1 100644 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -118,7 +118,7 @@ export TFS_GRAFANA_PASSWORD="admin123+" export TFS_SKIP_BUILD="" # Deploy TFS in production environment -export TFS_DEPLOY_PRODUCTION="" +export DEPLOY_TSDB_MODE="" # ----- CockroachDB ------------------------------------------------------------ -- GitLab From 6ba95b23f866a14dbca6a150c8918f6171b9e62b Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Wed, 5 Nov 2025 13:59:32 +0000 Subject: [PATCH 3/3] Pre-merge code cleanup --- deploy/all.sh | 17 +++++++++++++++++ deploy/monitoring.sh | 21 ++++++++++++++++++--- my_deploy.sh | 10 ++++++++-- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/deploy/all.sh b/deploy/all.sh index 85e27a640..cd33ff516 100755 --- a/deploy/all.sh +++ b/deploy/all.sh @@ -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. diff --git a/deploy/monitoring.sh b/deploy/monitoring.sh index 74b245684..a577c432f 100755 --- a/deploy/monitoring.sh +++ b/deploy/monitoring.sh @@ -15,8 +15,23 @@ set -euo pipefail -# Deploy TFS in production environment -export DEPLOY_TSDB_MODE=${DEPLOY_TSDB_MODE:-""} + +# ----- 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 @@ -108,7 +123,7 @@ kubectl rollout status deployment/"$RELEASE_NAME_PROM-server" -n "$NAMESPACE" || # 2) Deploy Mimir -if [ "$DEPLOY_TSDB_MODE" == "YES" ]; then +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" \ diff --git a/my_deploy.sh b/my_deploy.sh index a285fb0fe..24e1f6902 100644 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -120,8 +120,6 @@ export TFS_GRAFANA_PASSWORD="admin123+" # Disable skip-build flag to rebuild the Docker images. export TFS_SKIP_BUILD="" -# Deploy TFS in production environment -export DEPLOY_TSDB_MODE="" # ----- CockroachDB ------------------------------------------------------------ @@ -219,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. -- GitLab