Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring namespace deployment update #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/monitoring/grafana-prometheus-stack/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ variable extra_values {
type = map(string)
description = "MAP of extra Helm values"
}

variable namespace {
description = "Name of monitoring namespace"
type = string
default = "monitoring"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "helm_release" "kube-prometheus" {
name = "kube-prometheus-stack"
namespace = "monitoring"
namespace = var.namespace
version = "45.7.1"
repository = "https://prometheus-community.github.io/helm-charts"
chart = "kube-prometheus-stack"
Expand Down
18 changes: 18 additions & 0 deletions modules/monitoring/inputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
variable create_namespace {
description = "Whether or not to include to create the namespace"
type = bool
default = true
}

variable loki_extra_values {
type = map(string)
description = "MAP of Helm values for the Loki stack"
Expand Down Expand Up @@ -35,3 +41,15 @@ variable deploy_promtail {
default = true
description = "Deploy Promtail stack"
}

variable namespace {
description = "Name of monitoring Namespace"
type = string
default = "monitoring"
}

variable namespace_annotations {
type = map(string)
description = "MAP of annotations applied to the created namespace"
default = {}
}
6 changes: 6 additions & 0 deletions modules/monitoring/loki-stack/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ variable extra_values {
type = map(string)
description = "MAP of extra Helm values"
}

variable namespace {
description = "Name of monitoring namespace"
type = string
default = "monitoring"
}
2 changes: 1 addition & 1 deletion modules/monitoring/loki-stack/loki.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "helm_release" "loki" {
name = "loki"
namespace = "monitoring"
namespace = var.namespace
create_namespace = true
repository = "https://grafana.github.io/helm-charts"
chart = "loki"
Expand Down
28 changes: 28 additions & 0 deletions modules/monitoring/main.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,51 @@
module "monitoring_namespace" {
source = "../namespace"

namespace_annotations = var.namespace_annotations
create_namespace = var.deploy_grafana_prometheus == true || var.deploy_loki == true || var.deploy_promtail == true? var.create_namespace : false
namespace = var.namespace
}

# Install all monitoring sub modules
module "grafana_prometheus" {
count = var.deploy_grafana_prometheus == true ? 1 : 0
source = "./grafana-prometheus-stack"
namespace = var.namespace

grafana_additional_data_sources = var.grafana_additional_data_sources

extra_values = var.grafana_prometheus_extra_values

depends_on = [
module.monitoring_namespace
]

}

module "loki" {
count = var.deploy_loki == true ? 1 : 0
source = "./loki-stack"
namespace = var.namespace


extra_values = var.loki_extra_values

depends_on = [
module.monitoring_namespace
]

}

module "promtail" {
count = var.deploy_promtail == true ? 1 : 0
source = "./promtail-stack"
namespace = var.namespace


extra_values = var.promtail_extra_values

depends_on = [
module.monitoring_namespace
]

}
6 changes: 6 additions & 0 deletions modules/monitoring/promtail-stack/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ variable extra_values {
type = map(string)
description = "MAP of extra Helm values"
}

variable namespace {
description = "Name of monitoring namespace"
type = string
default = "monitoring"
}
2 changes: 1 addition & 1 deletion modules/monitoring/promtail-stack/promtail.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "helm_release" "promtail" {
name = "promtail"
namespace = "monitoring"
namespace = var.namespace
create_namespace = true
repository = "https://grafana.github.io/helm-charts"
chart = "promtail"
Expand Down
7 changes: 7 additions & 0 deletions profiles/core/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,13 @@ variable minio_namespace {
default = "io"
}

variable monitoring_namespace {
type = string
description = "Namespace for monitoring"
default = "monitoring"
}


variable postgres_namespace {
type = string
description = "Namespace for Postgres"
Expand Down
1 change: 1 addition & 0 deletions profiles/core/profile.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module "monitoring" {
grafana_prometheus_extra_values = var.grafana_prometheus_extra_values
grafana_additional_data_sources = var.grafana_additional_data_sources
promtail_extra_values = var.promtail_extra_values
namespace = var.monitoring_namespace

depends_on = [
module.service_mesh
Expand Down