feat(mail): add Dovecot and Getmail configurations with ingress setup for SFTPGo

This commit is contained in:
2025-05-05 19:56:43 +02:00
parent e6e85b00f7
commit d1267f816b
10 changed files with 530 additions and 486 deletions
+79
View File
@@ -0,0 +1,79 @@
resource "kubernetes_config_map" "getmail_config" {
metadata {
name = "getmail-config"
namespace = kubernetes_namespace.mail.metadata[0].name
}
data = local.getmail_config
}
resource "kubernetes_cron_job_v1" "fetch_emails" {
metadata {
namespace = kubernetes_namespace.mail.metadata[0].name
name = "fetch-emails"
}
spec {
schedule = var.fetch_emails_schedule
job_template {
metadata {
name = "fetch-emails"
}
spec {
backoff_limit = 1
parallelism = 1
completions = 1
active_deadline_seconds = 300
template {
metadata {
labels = {
app = "fetch-emails"
}
}
spec {
container {
name = "getmail"
image = "a13labs/getmail6:${var.getmail_tag}"
args = concat(["--getmaildir", "/var/getmail"], flatten([for job in local.getmail_jobs : ["-r", "/getmail/getmailrc_${job.name}"]]))
volume_mount {
name = "getmail-config"
mount_path = "/getmail"
read_only = true
}
security_context {
run_as_user = 1000
run_as_group = 1000
}
volume_mount {
name = "getmail-cache"
mount_path = "/var/getmail"
}
}
restart_policy = "Never"
volume {
name = "getmail-config"
config_map {
name = "getmail-config"
}
}
volume {
name = "getmail-cache"
host_path {
path = local.getmail_path
}
}
}
}
}
}
}
}