2024-11-05 21:55:45 +00:00
|
|
|
variable "tls_secret_name" {}
|
2026-01-10 16:28:12 +00:00
|
|
|
variable "tier" { type = string }
|
2024-11-05 21:55:45 +00:00
|
|
|
|
|
|
|
|
resource "kubernetes_namespace" "matrix" {
|
|
|
|
|
metadata {
|
|
|
|
|
name = "matrix"
|
|
|
|
|
labels = {
|
|
|
|
|
"istio-injection" : "disabled"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module "tls_secret" {
|
|
|
|
|
source = "../setup_tls_secret"
|
2025-12-29 10:23:42 +00:00
|
|
|
namespace = kubernetes_namespace.matrix.metadata[0].name
|
2024-11-05 21:55:45 +00:00
|
|
|
tls_secret_name = var.tls_secret_name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "kubernetes_deployment" "matrix" {
|
|
|
|
|
metadata {
|
|
|
|
|
name = "matrix"
|
2025-12-29 10:23:42 +00:00
|
|
|
namespace = kubernetes_namespace.matrix.metadata[0].name
|
2024-11-05 21:55:45 +00:00
|
|
|
labels = {
|
2026-01-10 16:28:12 +00:00
|
|
|
app = "matrix"
|
|
|
|
|
tier = var.tier
|
2024-11-05 21:55:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
spec {
|
2025-12-26 20:27:47 +00:00
|
|
|
replicas = 0
|
2024-11-05 21:55:45 +00:00
|
|
|
selector {
|
|
|
|
|
match_labels = {
|
|
|
|
|
app = "matrix"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
template {
|
|
|
|
|
metadata {
|
|
|
|
|
labels = {
|
|
|
|
|
app = "matrix"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
spec {
|
|
|
|
|
container {
|
|
|
|
|
image = "matrixdotorg/synapse:latest"
|
|
|
|
|
name = "matrix"
|
|
|
|
|
port {
|
|
|
|
|
container_port = 8008
|
|
|
|
|
}
|
|
|
|
|
env {
|
|
|
|
|
name = "SYNAPSE_SERVER_NAME"
|
|
|
|
|
value = "matrix.viktorbarzin.me"
|
|
|
|
|
}
|
|
|
|
|
env {
|
|
|
|
|
name = "SYNAPSE_REPORT_STATS"
|
|
|
|
|
value = "yes"
|
|
|
|
|
}
|
|
|
|
|
volume_mount {
|
|
|
|
|
name = "data"
|
|
|
|
|
mount_path = "/data"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
volume {
|
|
|
|
|
name = "data"
|
|
|
|
|
nfs {
|
|
|
|
|
server = "10.0.10.15"
|
|
|
|
|
path = "/mnt/main/matrix"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "kubernetes_service" "matrix" {
|
|
|
|
|
metadata {
|
|
|
|
|
name = "matrix"
|
2025-12-29 10:23:42 +00:00
|
|
|
namespace = kubernetes_namespace.matrix.metadata[0].name
|
2024-11-05 21:55:45 +00:00
|
|
|
labels = {
|
|
|
|
|
"app" = "matrix"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
spec {
|
|
|
|
|
selector = {
|
|
|
|
|
app = "matrix"
|
|
|
|
|
}
|
|
|
|
|
port {
|
|
|
|
|
name = "http"
|
|
|
|
|
port = "80"
|
|
|
|
|
target_port = "8008"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-14 22:53:04 +00:00
|
|
|
module "ingress" {
|
|
|
|
|
source = "../ingress_factory"
|
2025-12-29 10:23:42 +00:00
|
|
|
namespace = kubernetes_namespace.matrix.metadata[0].name
|
2025-01-14 22:53:04 +00:00
|
|
|
name = "matrix"
|
|
|
|
|
tls_secret_name = var.tls_secret_name
|
2024-11-05 21:55:45 +00:00
|
|
|
}
|