feat(cert-checker): add Kubernetes resources for certificate checking functionality

- Implemented a new module for cert-checker with Kubernetes resources including ServiceAccount, Role, RoleBinding, ConfigMap, and CronJob.
- Added Python script to check certificate expiry and restart deployments if necessary.
- Configured environment variables for deployment name, namespace, and service details.
- Included requirements for the Python environment.

feat(devolo-exporter): introduce Devolo exporter for Prometheus metrics

- Created a new module for Devolo exporter with Kubernetes resources including ServiceAccount, ConfigMap, Deployment, and Service.
- Developed Python scripts to scrape metrics from Devolo devices and expose them to Prometheus.
- Configured environment variables for Devolo device IP, model, and ports.
- Added requirements for the Python environment.
This commit is contained in:
2025-10-13 22:35:35 +02:00
parent 84c8288f8a
commit d069fe3585
25 changed files with 1362 additions and 33 deletions
+75 -11
View File
@@ -26,6 +26,18 @@ resource "kubernetes_secret" "samba_secrets" {
}
}
resource "kubernetes_config_map" "samba_config" {
metadata {
name = "samba-config"
namespace = kubernetes_namespace.samba.metadata[0].name
}
data = {
"smb.conf" = local.samba_config
}
}
resource "kubernetes_deployment" "samba" {
metadata {
name = "samba"
@@ -45,7 +57,7 @@ resource "kubernetes_deployment" "samba" {
}
strategy {
type = "Recreate"
type = "RollingUpdate"
}
template {
@@ -71,14 +83,14 @@ resource "kubernetes_deployment" "samba" {
port {
name = "smb-1"
container_port = 445
host_port = 445
host_port = var.host_port_enabled ? 445 : null
protocol = "TCP"
}
port {
name = "smb-2"
container_port = 139
host_port = 139
host_port = var.host_port_enabled ? 139 : null
protocol = "TCP"
}
@@ -103,15 +115,39 @@ resource "kubernetes_deployment" "samba" {
}
volume_mount {
name = "storage"
mount_path = "/storage"
name = "samba-config"
mount_path = "/etc/samba/smb.conf"
sub_path = "smb.conf"
read_only = true
}
dynamic "volume_mount" {
for_each = var.shares
content {
name = lower("samba-share-${volume_mount.value.name}")
mount_path = "/host/${volume_mount.value.path}"
}
}
}
volume {
name = "storage"
host_path {
path = var.shared_folder
name = "samba-config"
config_map {
name = kubernetes_config_map.samba_config.metadata[0].name
items {
key = "smb.conf"
path = "smb.conf"
}
}
}
dynamic "volume" {
for_each = var.shares
content {
name = lower("samba-share-${volume.value.name}")
host_path {
path = volume.value.path
type = "DirectoryOrCreate"
}
}
}
}
@@ -123,9 +159,9 @@ resource "kubernetes_deployment" "samba" {
}
}
resource "kubernetes_service" "samba" {
resource "kubernetes_service" "smb" {
metadata {
name = "samba-ports"
name = "smb"
namespace = kubernetes_namespace.samba.metadata[0].name
}
@@ -140,7 +176,7 @@ resource "kubernetes_service" "samba" {
target_port = 445
}
type = "LoadBalancer"
type = "ClusterIP"
}
lifecycle {
@@ -149,3 +185,31 @@ resource "kubernetes_service" "samba" {
]
}
}
resource "kubernetes_service" "netbios" {
metadata {
name = "netbios"
namespace = kubernetes_namespace.samba.metadata[0].name
}
spec {
selector = {
samba = "samba"
}
port {
name = "netbios"
port = 139
target_port = 139
}
type = "ClusterIP"
}
lifecycle {
ignore_changes = [
metadata[0].annotations
]
}
}