Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
🏗️ Add Prometheus persistent storage configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
p-bizouard authored and claudusd committed Jun 4, 2024
1 parent 950822f commit cfa36ef
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 30 deletions.
9 changes: 9 additions & 0 deletions common/prom-grafana-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,14 @@ grafana:
default_home_dashboard_path: /var/lib/grafana/dashboards/k8s/k8s-views-global.json
prometheus:
prometheusSpec:
%{ if prometheus_persistence_enabled }
storageSpec:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: ${prometheus_persistence_size}
%{ endif }
podMonitorSelectorNilUsesHelmValues: false
serviceMonitorSelectorNilUsesHelmValues: false
2 changes: 2 additions & 0 deletions common/prometheus-grafana.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ resource "helm_release" "kube-prometheus" {
grafana_admin_password = var.grafana_admin_password
grafana_persistence_enabled = var.grafana_persistence_enabled
grafana_persistence_size = var.grafana_persistence_size
prometheus_persistence_enabled = var.prometheus_persistence_enabled
prometheus_persistence_size = var.prometheus_persistence_size
})]
}
12 changes: 12 additions & 0 deletions common/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ variable "grafana_persistence_size" {
default = "10Gi"
}

variable "prometheus_persistence_enabled" {
type = bool
description = "Enable Prometheus persistence"
default = false
}

variable "prometheus_persistence_size" {
type = string
description = "Prometheus persistence size"
default = "20Gi"
}

variable "vault_server_hostname" {
type = string
description = "The hostname to use for the Vault server ingress"
Expand Down
2 changes: 2 additions & 0 deletions ovh/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ grafana_hostname = "grafana.kubic.example"
grafana_admin_password = "change_me"
grafana_persistence_enabled = true
grafana_persistence_size = "10Gi"
prometheus_persistence_enabled = true
prometheus_persistence_size = "20Gi"
vault_server_hostname = "vault.kubic.example"
install_hashicorp_vault = true
vault_ui = true
Expand Down
2 changes: 2 additions & 0 deletions ovh/terraform.tfvars.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ grafana_hostname=""
grafana_admin_password=""
grafana_persistence_enabled =
grafana_persistence_size = ""
prometheus_persistence_enabled =
prometheus_persistence_size = ""
vault_server_hostname=""
install_hashicorp_vault=true
vault_ui=true
Expand Down
2 changes: 2 additions & 0 deletions scaleway/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ grafana_hostname = "grafana.kubic.example"
grafana_admin_password = "change_me"
grafana_persistence_enabled = true
grafana_persistence_size = "10Gi"
prometheus_persistence_enabled = true
prometheus_persistence_size = "20Gi"
vault_server_hostname = "vault.kubic.example"
install_hashicorp_vault = true
vault_ui = true
Expand Down
2 changes: 2 additions & 0 deletions scaleway/terraform.tfvars.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ grafana_hostname = ""
grafana_admin_password = ""
grafana_persistence_enabled =
grafana_persistence_size = ""
prometheus_persistence_enabled =
prometheus_persistence_size = ""
vault_server_hostname = ""
install_hashicorp_vault =
vault_ui =
Expand Down
2 changes: 2 additions & 0 deletions standalone/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ grafana_hostname = "grafana.kubic.example"
grafana_admin_password = "change_me"
grafana_persistence_enabled = true
grafana_persistence_size = "10Gi"
prometheus_persistence_enabled = true
prometheus_persistence_size = "20Gi"
vault_server_hostname = "vault.kubic.example"
install_hashicorp_vault = true
vault_ui = true
Expand Down
63 changes: 33 additions & 30 deletions state_bucket/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cfa36ef

Please sign in to comment.