From 068c909246b93f92580ac06904b6428455b96367 Mon Sep 17 00:00:00 2001 From: Buster Styren Date: Fri, 21 Apr 2023 13:56:01 +0200 Subject: [PATCH] fix: use /grafana path for monitoring endpoint --- .../modules/container-registry/terragrunt.hcl | 5 +++++ infrastructure/modules/monitoring/main.tf | 4 +++- infrastructure/modules/monitoring/terragrunt.hcl | 5 +++++ infrastructure/modules/monitoring/values.yaml | 12 +++++++----- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/infrastructure/modules/container-registry/terragrunt.hcl b/infrastructure/modules/container-registry/terragrunt.hcl index aef53a2..7672726 100644 --- a/infrastructure/modules/container-registry/terragrunt.hcl +++ b/infrastructure/modules/container-registry/terragrunt.hcl @@ -1,3 +1,8 @@ include "root" { path = find_in_parent_folders("root.hcl") } + +dependency "nginx_ingress" { + config_path = "../nginx-ingress" + skip_outputs = true +} diff --git a/infrastructure/modules/monitoring/main.tf b/infrastructure/modules/monitoring/main.tf index 6c70725..6f3e396 100644 --- a/infrastructure/modules/monitoring/main.tf +++ b/infrastructure/modules/monitoring/main.tf @@ -43,7 +43,7 @@ resource "helm_release" "prometheus_stack" { values = [ templatefile("${path.module}/values.yaml", { namespace = local.namespace, - grafana_host = "grafana.${data.kubernetes_config_map.domain.data.domain}", + host = data.kubernetes_config_map.domain.data.domain, ingress_annotations = jsonencode(var.ingress_annotations), }) ] @@ -52,6 +52,8 @@ resource "helm_release" "prometheus_stack" { name = "grafana.adminPassword" value = random_password.grafana.result } + + timeout = 600 } resource "helm_release" "jaeger_operator" { diff --git a/infrastructure/modules/monitoring/terragrunt.hcl b/infrastructure/modules/monitoring/terragrunt.hcl index abc63db..7d6de14 100644 --- a/infrastructure/modules/monitoring/terragrunt.hcl +++ b/infrastructure/modules/monitoring/terragrunt.hcl @@ -6,3 +6,8 @@ dependency "cert_manager" { config_path = "../cert-manager" skip_outputs = true } + +dependency "nginx_ingress" { + config_path = "../nginx-ingress" + skip_outputs = true +} diff --git a/infrastructure/modules/monitoring/values.yaml b/infrastructure/modules/monitoring/values.yaml index 018fc12..87d0c3a 100644 --- a/infrastructure/modules/monitoring/values.yaml +++ b/infrastructure/modules/monitoring/values.yaml @@ -24,8 +24,9 @@ grafana: grafana.ini: server: - domain: ${grafana_host} - root_url: "%(protocol)s://%(domain)s/" + domain: ${host} + root_url: "%(protocol)s://%(domain)s/grafana/" + serve_from_sub_path: true alerting: enabled: false unified_alerting: @@ -47,15 +48,16 @@ grafana: ingress: enabled: true annotations: - "acme.cert-manager.io/http01-edit-in-place": "true" "kubernetes.io/ingress.class": "nginx" "kubernetes.io/tls-acme": "true" "cert-manager.io/cluster-issuer": "letsencrypt" - hosts: ["${grafana_host}"] + "nginx.ingress.kubernetes.io/rewrite-target": "/$2" + hosts: ["${host}"] pathType: Prefix + path: /grafana(/|$)(.*) tls: - secretName: grafana-general-tls - hosts: ["${grafana_host}"] + hosts: ["${host}"] prometheus: enabled: true