-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from sparkfabrik/feature/2586_prometheus_stack…
…_improvements refs platform/#2586: kube-prometheus-stack improvements
- Loading branch information
Showing
5 changed files
with
82 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,73 @@ | ||
# Kube prometheus stack | ||
# https://github.com/sparkfabrik/terraform-sparkfabrik-prometheus-stack | ||
# https://github.com/prometheus-community/helm-charts/tree/kube-prometheus-stack-54.2.2/charts/kube-prometheus-stack | ||
locals { | ||
# https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack | ||
kube_prometheus_namespace = "prometheus" | ||
kube_prometheus_stack_chart_version = "46.4.0" | ||
storage_class_name = "${local.kube_prometheus_namespace}-sc" | ||
} | ||
|
||
module "kube_prometheus_stack" { | ||
count = var.enable_kube_prometheus_stack ? 1 : 0 | ||
kube_prometheus_stack_chart_version = "54.2.2" | ||
storage_class_name = "prometheus-sc" | ||
|
||
source = "github.com/sparkfabrik/terraform-sparkfabrik-prometheus-stack?ref=cd54564" | ||
|
||
prometheus_stack_chart_version = local.kube_prometheus_stack_chart_version | ||
create_namespace = true | ||
namespace = local.kube_prometheus_namespace | ||
grafana_ingress_host = var.kube_prometheus_grafana_hostname | ||
grafana_ingress_basic_auth_username = "admin" | ||
regcred = "" | ||
grafana_cluster_issuer_name = local.cert_manager_cluster_issuer_name | ||
grafana_ingress_basic_auth_message = "Restricted Access" | ||
|
||
prometheus_stack_additional_values = templatefile( | ||
"${path.module}/files/kube-prometheus-stack/values.yaml", | ||
{ | ||
storage_class_name = local.storage_class_name | ||
grafana_hostname = var.kube_prometheus_grafana_hostname | ||
} | ||
prometheus_stack_additional_values = concat( | ||
[ | ||
templatefile( | ||
"${path.module}/files/kube-prometheus-stack/values.yaml", | ||
{ | ||
storage_class_name = local.storage_class_name | ||
grafana_hostname = var.kube_prometheus_grafana_hostname | ||
} | ||
) | ||
], | ||
var.prometheus_stack_additional_values | ||
) | ||
|
||
depends_on = [ kubernetes_manifest.ebs_storageclass ] | ||
} | ||
|
||
resource "kubernetes_manifest" "ebs_storageclass" { | ||
count = var.enable_kube_prometheus_stack ? 1 : 0 | ||
|
||
manifest = { | ||
"apiVersion" = "storage.k8s.io/v1" | ||
"kind" = "StorageClass" | ||
"metadata" = { | ||
"name" = local.storage_class_name | ||
} | ||
"parameters" = { | ||
"csi.storage.k8s.io/fstype" = "xfs" | ||
"encrypted" = "false" | ||
"type" = "gp3" | ||
} | ||
"provisioner" = "ebs.csi.aws.com" | ||
"volumeBindingMode" = "WaitForFirstConsumer" | ||
|
||
# The allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. | ||
# This configuration is useful to be sure that the volumes are created in the same AZ of the nodes | ||
# dedicated to the monitoring stack. | ||
"allowedTopologies" = [ | ||
{ | ||
"matchLabelExpressions" = [ | ||
{ | ||
"key" = "topology.ebs.csi.aws.com/zone" | ||
"key" = "topology.ebs.csi.aws.com/zone" | ||
"values" = var.kube_prometheus_storage_zone | ||
}, | ||
] | ||
}, | ||
] | ||
"apiVersion" = "storage.k8s.io/v1" | ||
"kind" = "StorageClass" | ||
"metadata" = { | ||
"name" = local.storage_class_name | ||
} | ||
"parameters" = { | ||
"csi.storage.k8s.io/fstype" = "xfs" | ||
"encrypted" = "false" | ||
"type" = "gp3" | ||
} | ||
"provisioner" = "ebs.csi.aws.com" | ||
"volumeBindingMode" = "WaitForFirstConsumer" | ||
} | ||
} | ||
|
||
module "kube_prometheus_stack" { | ||
count = var.enable_kube_prometheus_stack ? 1 : 0 | ||
|
||
source = "github.com/sparkfabrik/terraform-sparkfabrik-prometheus-stack?ref=3.0.0" | ||
|
||
prometheus_stack_chart_version = local.kube_prometheus_stack_chart_version | ||
namespace = local.kube_prometheus_namespace | ||
create_namespace = true | ||
grafana_ingress_host = var.kube_prometheus_grafana_hostname | ||
grafana_ingress_basic_auth_username = "admin" | ||
regcred = "" | ||
grafana_cluster_issuer_name = local.cert_manager_cluster_issuer_name | ||
grafana_ingress_basic_auth_message = "Restricted Access" | ||
|
||
prometheus_stack_additional_values = local.prometheus_stack_additional_values | ||
|
||
depends_on = [kubernetes_manifest.ebs_storageclass] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters