2024-07-10 14:54:27 +03:00
|
|
|
resource "kubernetes_deployment" "twentycrm_db" {
|
|
|
|
metadata {
|
2024-08-08 14:55:45 +03:00
|
|
|
name = "${var.twentycrm_app_name}-db"
|
2024-07-10 14:54:27 +03:00
|
|
|
namespace = kubernetes_namespace.twentycrm.metadata.0.name
|
|
|
|
labels = {
|
2024-08-08 14:55:45 +03:00
|
|
|
app = "${var.twentycrm_app_name}-db"
|
2024-07-10 14:54:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spec {
|
2024-08-08 14:55:45 +03:00
|
|
|
replicas = var.twentycrm_db_replicas
|
2024-07-10 14:54:27 +03:00
|
|
|
selector {
|
|
|
|
match_labels = {
|
2024-08-08 14:55:45 +03:00
|
|
|
app = "${var.twentycrm_app_name}-db"
|
2024-07-10 14:54:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
strategy {
|
|
|
|
type = "RollingUpdate"
|
|
|
|
rolling_update {
|
|
|
|
max_surge = "1"
|
|
|
|
max_unavailable = "1"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
metadata {
|
|
|
|
labels = {
|
2024-08-08 14:55:45 +03:00
|
|
|
app = "${var.twentycrm_app_name}-db"
|
2024-07-10 14:54:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spec {
|
|
|
|
container {
|
2024-08-08 14:55:45 +03:00
|
|
|
image = var.twentycrm_db_image
|
|
|
|
name = var.twentycrm_app_name
|
2024-07-10 14:54:27 +03:00
|
|
|
stdin = true
|
|
|
|
tty = true
|
|
|
|
security_context {
|
|
|
|
allow_privilege_escalation = true
|
|
|
|
}
|
|
|
|
|
|
|
|
env {
|
|
|
|
name = "POSTGRES_PASSWORD"
|
2024-08-08 14:55:45 +03:00
|
|
|
value = var.twentycrm_pgdb_admin_password
|
2024-07-10 14:54:27 +03:00
|
|
|
}
|
|
|
|
env {
|
|
|
|
name = "BITNAMI_DEBUG"
|
|
|
|
value = true
|
|
|
|
}
|
|
|
|
|
|
|
|
port {
|
|
|
|
container_port = 5432
|
|
|
|
protocol = "TCP"
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
requests = {
|
|
|
|
cpu = "250m"
|
|
|
|
memory = "256Mi"
|
|
|
|
}
|
|
|
|
limits = {
|
|
|
|
cpu = "1000m"
|
|
|
|
memory = "1024Mi"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
2024-08-08 14:55:45 +03:00
|
|
|
name = "db-data"
|
2024-07-10 14:54:27 +03:00
|
|
|
mount_path = "/bitnami/postgresql"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
volume {
|
2024-08-08 14:55:45 +03:00
|
|
|
name = "db-data"
|
2024-07-10 14:54:27 +03:00
|
|
|
|
|
|
|
persistent_volume_claim {
|
2024-08-08 14:55:45 +03:00
|
|
|
claim_name = kubernetes_persistent_volume_claim.db.metadata.0.name
|
2024-07-10 14:54:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dns_policy = "ClusterFirst"
|
|
|
|
restart_policy = "Always"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|