Files
a13labs.infra/terraform/modules/utils/auth-exporter/main.tf
T
alexandre.pires 429a94332e feat: add disk exporter module and related configurations
- Introduced a new disk exporter module to monitor disk health using SMART data.
- Updated `apps.tf` to include the disk exporter module with necessary parameters.
- Added local variables for smartctl version and checksum in `config.tf`.
- Enhanced `alertmanager.yml` to handle DiskUnhealthy alerts with specific grouping and dispatch settings.
- Created new Prometheus rules for monitoring disk health, including alerts for unhealthy disks.
- Updated Prometheus configuration to scrape metrics from the new disk exporter.
- Enhanced Telegram notification template to include resolved alerts and improved formatting.
- Updated the auth-exporter module to specify the Python image tag correctly.
- Created the disk-exporter module with Kubernetes resources, including deployment, service account, and config map.
- Added necessary Python scripts and requirements for the disk exporter functionality.
2025-10-06 18:41:01 +02:00

122 lines
2.8 KiB
Terraform

resource "kubernetes_service_account" "auth_exporter" {
metadata {
name = "auth-exporter-sa"
namespace = var.namespace
}
}
resource "kubernetes_config_map" "auth_exporter" {
metadata {
name = "auth-exporter-config"
namespace = var.namespace
}
data = {
"exporter.py" = local.exporter_script
"requirements.txt" = local.requirements_txt
}
}
resource "kubernetes_deployment" "auth_exporter" {
metadata {
name = "auth-exporter"
namespace = var.namespace
labels = {
app = "auth-exporter"
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "auth-exporter"
}
}
template {
metadata {
labels = {
app = "auth-exporter"
}
annotations = {
"checksum/exporter" = local.exporter_checksum
"checksum/requirements" = local.requirements_checksum
}
}
spec {
service_account_name = kubernetes_service_account.auth_exporter.metadata[0].name
automount_service_account_token = false
container {
name = "auth-exporter"
image = "python:${var.tag}"
command = ["sh", "-c", join(" && ", local.commands)]
port {
container_port = 9100
name = "http-metrics"
}
volume_mount {
name = "exporter-volume"
mount_path = "/exporter"
read_only = true
}
volume_mount {
name = "workdir"
mount_path = "/tmp"
}
volume_mount {
name = "host-logs"
mount_path = "/var/log"
read_only = true
}
security_context {
run_as_user = 0
run_as_group = 0
read_only_root_filesystem = true
}
}
volume {
name = "exporter-volume"
config_map {
name = kubernetes_config_map.auth_exporter.metadata[0].name
}
}
volume {
name = "workdir"
host_path {
path = local.workdir
type = "DirectoryOrCreate"
}
}
volume {
name = "host-logs"
host_path {
path = "/var/log"
type = "Directory"
}
}
}
}
}
}
resource "kubernetes_service" "auth_exporter" {
metadata {
name = "auth-exporter"
namespace = var.namespace
labels = {
app = "auth-exporter"
}
}
spec {
selector = {
app = "auth-exporter"
}
port {
port = 9100
target_port = 9100
protocol = "TCP"
name = "http-metrics"
}
type = "ClusterIP"
}
}