diff --git a/CHANGELOG.md b/CHANGELOG.md index ca312517c..88e0f24ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed - [#928](https://github.com/XenitAB/terraform-modules/pull/928) Enable Node TTL by default. +- [#935](https://github.com/XenitAB/terraform-modules/pull/935) Update Node TTL to v0.0.6 and enable monitoring. - [#933](https://github.com/XenitAB/terraform-modules/pull/933) Change from starboard to trivy-operator. ## 2023.02.1 diff --git a/modules/kubernetes/aks-core/modules.tf b/modules/kubernetes/aks-core/modules.tf index 6794d106e..5e374db2d 100644 --- a/modules/kubernetes/aks-core/modules.tf +++ b/modules/kubernetes/aks-core/modules.tf @@ -527,6 +527,7 @@ module "prometheus" { node_local_dns_enabled = var.node_local_dns_enabled grafana_agent_enabled = var.grafana_agent_enabled promtail_enabled = var.promtail_enabled + node_ttl_enabled = var.node_ttl_enabled } module "control_plane_logs" { diff --git a/modules/kubernetes/eks-core/modules.tf b/modules/kubernetes/eks-core/modules.tf index 58f209525..9df4be002 100644 --- a/modules/kubernetes/eks-core/modules.tf +++ b/modules/kubernetes/eks-core/modules.tf @@ -381,6 +381,7 @@ module "prometheus" { vpa_enabled = var.vpa_enabled node_local_dns_enabled = var.node_local_dns_enabled promtail_enabled = var.promtail_enabled + node_ttl_enabled = var.node_ttl_enabled } # trivy diff --git a/modules/kubernetes/node-ttl/main.tf b/modules/kubernetes/node-ttl/main.tf index 9bf51e548..533c49f94 100644 --- a/modules/kubernetes/node-ttl/main.tf +++ b/modules/kubernetes/node-ttl/main.tf @@ -33,7 +33,7 @@ resource "helm_release" "this" { chart = "oci://ghcr.io/xenitab/helm-charts/node-ttl" name = "node-ttl" namespace = kubernetes_namespace.this.metadata[0].name - version = "v0.0.5" + version = "v0.0.6" max_history = 3 values = [templatefile("${path.module}/templates/values.yaml.tpl", { status_config_map_namespace = var.status_config_map_namespace diff --git a/modules/kubernetes/prometheus/README.md b/modules/kubernetes/prometheus/README.md index 2c83e9e64..999ee330c 100644 --- a/modules/kubernetes/prometheus/README.md +++ b/modules/kubernetes/prometheus/README.md @@ -51,6 +51,7 @@ No modules. | [linkerd\_enabled](#input\_linkerd\_enabled) | Should linkerd be enabled | `bool` | `false` | no | | [namespace\_selector](#input\_namespace\_selector) | Kind labels to look for in namespaces | `list(string)` |
[| no | | [node\_local\_dns\_enabled](#input\_node\_local\_dns\_enabled) | Should node local DNS be enabled | `bool` | `false` | no | +| [node\_ttl\_enabled](#input\_node\_ttl\_enabled) | Should Node TTL be enabled | `bool` | `false` | no | | [opa\_gatekeeper\_enabled](#input\_opa\_gatekeeper\_enabled) | Should OPA Gatekeeper be enabled | `bool` | `false` | no | | [promtail\_enabled](#input\_promtail\_enabled) | Should promtail be enabled | `bool` | `false` | no | | [region](#input\_region) | The region in which the prometheus instance is deployed | `string` | n/a | yes | diff --git a/modules/kubernetes/prometheus/charts/prometheus-extras/templates/monitors.yaml b/modules/kubernetes/prometheus/charts/prometheus-extras/templates/monitors.yaml index 67f045b69..a4b21ba4e 100644 --- a/modules/kubernetes/prometheus/charts/prometheus-extras/templates/monitors.yaml +++ b/modules/kubernetes/prometheus/charts/prometheus-extras/templates/monitors.yaml @@ -445,6 +445,23 @@ spec: app.kubernetes.io/instance: promtail app.kubernetes.io/name: promtail {{- end }} +{{- if .Values.enabledMonitors.nodeTtl }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + xkf.xenit.io/monitoring: platform + name: node-ttl + namespace: node-ttl +spec: + selector: + matchLabels: + app.kubernetes.io/name: node-ttl + app.kubernetes.io/instance: node-ttl + endpoints: + - port: metrics +{{- end }} --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor diff --git a/modules/kubernetes/prometheus/main.tf b/modules/kubernetes/prometheus/main.tf index 51b46f04d..37f5b927a 100644 --- a/modules/kubernetes/prometheus/main.tf +++ b/modules/kubernetes/prometheus/main.tf @@ -105,6 +105,7 @@ resource "helm_release" "prometheus_extras" { grafana_agent_enabled = var.grafana_agent_enabled node_local_dns_enabled = var.node_local_dns_enabled promtail_enabled = var.promtail_enabled + node_ttl_enabled = var.node_ttl_enabled })] } diff --git a/modules/kubernetes/prometheus/templates/values-extras.yaml.tpl b/modules/kubernetes/prometheus/templates/values-extras.yaml.tpl index aeafef3ea..c0760120e 100644 --- a/modules/kubernetes/prometheus/templates/values-extras.yaml.tpl +++ b/modules/kubernetes/prometheus/templates/values-extras.yaml.tpl @@ -49,3 +49,4 @@ enabledMonitors: grafanaAgent: ${grafana_agent_enabled} nodeLocalDNS: ${node_local_dns_enabled} promtail: ${promtail_enabled} + nodeTtl: ${node_ttl_enabled} diff --git a/modules/kubernetes/prometheus/variables.tf b/modules/kubernetes/prometheus/variables.tf index 4db789578..d94d4eb26 100644 --- a/modules/kubernetes/prometheus/variables.tf +++ b/modules/kubernetes/prometheus/variables.tf @@ -168,3 +168,9 @@ variable "promtail_enabled" { type = bool default = false } + +variable "node_ttl_enabled" { + description = "Should Node TTL be enabled" + type = bool + default = false +}
"platform"
]