Files
a13labs.infra/terraform/modules/apps/comfyui/main.tf
T

99 lines
1.8 KiB
Terraform
Raw Normal View History

resource "kubernetes_namespace" "comfyui" {
metadata {
name = "comfyui"
}
}
resource "kubernetes_service_account" "comfyui" {
metadata {
name = "comfyui-sa"
namespace = kubernetes_namespace.comfyui.metadata[0].name
}
automount_service_account_token = false
}
resource "kubernetes_deployment" "comfyui" {
metadata {
name = "comfyui"
namespace = kubernetes_namespace.comfyui.metadata[0].name
labels = {
comfyui = "comfyui"
}
}
spec {
replicas = 1
selector {
match_labels = {
comfyui = "comfyui"
}
}
strategy {
type = "RollingUpdate"
}
template {
metadata {
labels = {
comfyui = "comfyui"
}
}
spec {
service_account_name = kubernetes_service_account.comfyui.metadata[0].name
automount_service_account_token = false
container {
name = "comfyui"
image = "a13labs/comfyui:${local.comfyui_version}"
security_context {
allow_privilege_escalation = false
}
port {
name = "frontend"
container_port = 5173
protocol = "TCP"
}
env {
name = "DEV_SERVER_COMFYUI_URL"
value = coalesce(var.backend, "http://localhost:8188")
}
}
}
}
}
}
resource "kubernetes_service" "comfyui" {
metadata {
name = "frontend"
namespace = kubernetes_namespace.comfyui.metadata[0].name
}
spec {
selector = {
comfyui = "comfyui"
}
port {
name = "frontend"
port = 5173
target_port = 5173
}
}
lifecycle {
ignore_changes = [
metadata[0].annotations
]
}
}