Skip to content

Commit cdec1f2

Browse files
authored
[helm] Add support for monitoring stack (#1325)
1 parent f6bd5eb commit cdec1f2

File tree

12 files changed

+331
-9
lines changed

12 files changed

+331
-9
lines changed

deploy/infrastructure/dependencies/terraform-commons-dss/helm.tf

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,32 @@ resource "local_file" "helm_chart_values" {
9191
global = {
9292
cloudProvider = var.kubernetes_cloud_provider_name
9393
}
94+
95+
monitoring = {
96+
enabled = false
97+
},
98+
99+
prometheus = {
100+
server = {
101+
persistentVolume = {
102+
storageClass = var.kubernetes_storage_class
103+
}
104+
105+
global = {
106+
external_labels = {
107+
environment = "dev"
108+
k8s_cluster = var.cluster_name
109+
}
110+
}
111+
}
112+
}
113+
114+
grafana = {
115+
persistence = {
116+
storageClassName = var.kubernetes_storage_class
117+
}
118+
}
119+
94120
}) : yamlencode({
95121
cockroachdb = {
96122
enabled = false
@@ -261,6 +287,31 @@ resource "local_file" "helm_chart_values" {
261287
global = {
262288
cloudProvider = var.kubernetes_cloud_provider_name
263289
}
290+
291+
monitoring = {
292+
enabled = false
293+
},
294+
295+
prometheus = {
296+
server = {
297+
persistentVolume = {
298+
storageClass = var.kubernetes_storage_class
299+
}
300+
301+
global = {
302+
external_labels = {
303+
environment = "dev"
304+
k8s_cluster = var.cluster_name
305+
}
306+
}
307+
}
308+
}
309+
310+
grafana = {
311+
persistence = {
312+
storageClassName = var.kubernetes_storage_class
313+
}
314+
}
264315
})
265316

266317
}

deploy/infrastructure/dependencies/terraform-commons-dss/variables.gen.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ variable "node_count" {
5555
}
5656

5757

58+
variable "cluster_name" {
59+
type = string
60+
description = <<-EOT
61+
Name of the kubernetes cluster that will host this DSS instance (should generally describe the DSS instance being hosted)
62+
63+
Example: `dss-che-1`
64+
EOT
65+
}
66+
5867
variable "image" {
5968
type = string
6069
description = <<-EOT

deploy/infrastructure/modules/terraform-aws-dss/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module "terraform-aws-kubernetes" {
1616

1717
module "terraform-commons-dss" {
1818
# See variables.tf for variables description.
19+
cluster_name = var.cluster_name
1920
image = var.image
2021
image_pull_secret = var.image_pull_secret
2122
kubernetes_namespace = var.kubernetes_namespace

deploy/infrastructure/modules/terraform-google-dss/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module "terraform-google-kubernetes" {
1616

1717
module "terraform-commons-dss" {
1818
# See variables.tf for variables description.
19+
cluster_name = var.cluster_name
1920
image = var.image
2021
kubernetes_namespace = var.kubernetes_namespace
2122
kubernetes_storage_class = var.google_kubernetes_storage_class

deploy/infrastructure/utils/variables.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# Variables per project
2525
# For all */terraform-*
26-
GLOBAL_VARIABLES = ["app_hostname", "db_hostname_suffix", "datastore_type", "node_count"]
26+
GLOBAL_VARIABLES = ["app_hostname", "db_hostname_suffix", "datastore_type", "node_count", "cluster_name"]
2727

2828
# dependencies/terraform-commons-dss
2929
COMMONS_DSS_VARIABLES = GLOBAL_VARIABLES + [
@@ -59,7 +59,6 @@
5959

6060
# dependencies/terraform-*-kubernetes
6161
COMMON_KUBERNETES_VARIABLES = GLOBAL_VARIABLES + [
62-
"cluster_name",
6362
"kubernetes_version",
6463
]
6564

deploy/services/helm-charts/dss/Chart.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ dependencies:
1313
repository: https://interuss.github.io/yugabyte-charts/
1414
version: 2025.1.0
1515
condition: yugabyte.enabled
16+
- name: prometheus
17+
repository: https://prometheus-community.github.io/helm-charts
18+
version: 27.51.0
19+
condition: monitoring.enabled
20+
- name: grafana
21+
repository: https://grafana.github.io/helm-charts
22+
version: 10.3.1
23+
condition: monitoring.enabled
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../tanka/grafana_dashboards
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- if $.Values.monitoring.enabled }}
2+
3+
---
4+
5+
apiVersion: v1
6+
kind: ConfigMap
7+
metadata:
8+
name: dss-grafana-dashboards-default
9+
labels:
10+
grafana_dashboard: "1"
11+
data:
12+
{{- range $path, $bytes := .Files.Glob "grafana_dashboards/*.json" }}
13+
{{ base $path }}: |-
14+
{{ $.Files.Get $path | indent 4 }}
15+
{{- end }}
16+
17+
{{- end }}

deploy/services/helm-charts/dss/values.example.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,15 @@ loadBalancers:
7777

7878
global:
7979
cloudProvider: google
80+
81+
monitoring: # Set to true to enable monitoring stack
82+
enabled: true
83+
84+
prometheus:
85+
server:
86+
persistentVolume:
87+
storageClass: standard # If you need a specfic storage class, set it there
88+
89+
grafana:
90+
persistence:
91+
storageClassName: standard # If you need a specfic storage class, set it there

deploy/services/helm-charts/dss/values.schema.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,23 @@
342342
}
343343
},
344344
"required": ["cloudProvider"]
345+
},
346+
"monitoring": {
347+
"type": "object",
348+
"properties": {
349+
"enabled": {
350+
"type": "boolean",
351+
"description": "Enable monitoring stack with prometheus and grafana."
352+
}
353+
},
354+
"required": ["enabled"]
345355
}
346356
},
347357
"required": [
348358
"loadBalancers",
349359
"dss",
350-
"global"
360+
"global",
361+
"monitoring"
351362
],
352363
"title": "Values",
353364
"type": "object"

0 commit comments

Comments
 (0)