infra/stacks/immich/frame.tf
Viktor Barzin bc41fe572a immich: GPU-accelerate video transcoding (NVENC + NVDEC)
Pin immich-server to the GPU node with a time-sliced nvidia.com/gpu slice
so ffmpeg uses hardware NVENC encode + NVDEC decode instead of software.
This frees the ~3-4 CPU cores the software transcoder was burning inside
the request-serving pod (which was slowing thumbnail/photo browsing), and
makes incompatible (HEVC/iPhone) videos playable in seconds. Activation is
ffmpeg.accel=nvenc + accelDecode=true in the DB system-config (Immich app
config is DB-managed here, like oauth/smtp — not Terraform).

Also give immich-frame the same Keel ignore_changes immich-server already
has, so an untargeted apply no longer churns it (pre-existing drift).

Docs: .claude/CLAUDE.md Immich row + compute.md GPU-workloads list.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 18:05:34 +00:00

146 lines
3.6 KiB
HCL

resource "kubernetes_config_map" "mailserver_config" {
metadata {
name = "config"
namespace = "immich"
labels = {
app = "frame-config"
}
annotations = {
"reloader.stakater.com/match" = "true"
}
}
data = {
# Actual mail settings
"Settings.yml" = <<-EOF
General:
Layout: single
Interval: 10
ImageZoom: false
ShowAlbumName: false
ShowProgressBar: false
Accounts:
- ImmichServerUrl: http://immich.viktorbarzin.me
ApiKey: ${data.vault_kv_secret_v2.secrets.data["frame_api_key"]}
Albums:
- 1aa98849-bbd5-452b-aac0-310b210a8597 # china
EOF
}
}
resource "kubernetes_deployment" "immich-frame" {
metadata {
name = "immich-frame"
namespace = "immich"
annotations = {
"reloader.stakater.com/search" = "true"
}
labels = {
tier = local.tiers.gpu
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "immich-frame"
}
}
strategy {
type = "RollingUpdate"
}
template {
metadata {
labels = {
app = "immich-frame"
}
annotations = {
"dependency.kyverno.io/wait-for" = "immich-server.immich:2283"
}
}
spec {
container {
image = "ghcr.io/immichframe/immichframe:v1.0.32.0"
name = "immich-frame"
resources {
requests = {
cpu = "10m"
memory = "64Mi"
}
limits = {
memory = "128Mi"
}
}
port {
container_port = 8080
protocol = "TCP"
name = "http"
}
volume_mount {
name = "config"
mount_path = "/app/Config"
read_only = true
}
}
volume {
name = "config"
config_map {
name = "config"
}
}
}
}
}
lifecycle {
ignore_changes = [
spec[0].template[0].spec[0].dns_config, # KYVERNO_LIFECYCLE_V1
metadata[0].annotations["keel.sh/policy"],
metadata[0].annotations["keel.sh/trigger"],
metadata[0].annotations["keel.sh/pollSchedule"], # KYVERNO_LIFECYCLE_V2
metadata[0].annotations["keel.sh/match-tag"],
metadata[0].annotations["kubernetes.io/change-cause"],
metadata[0].annotations["deployment.kubernetes.io/revision"],
spec[0].template[0].metadata[0].annotations["keel.sh/update-time"], # KEEL_LIFECYCLE_V1
spec[0].template[0].spec[0].container[0].image, # KEEL_IGNORE_IMAGE
]
}
}
resource "kubernetes_service" "immich-frame" {
metadata {
name = "immich-frame"
namespace = "immich"
labels = {
"app" = "immich-frame"
}
}
spec {
selector = {
app = "immich-frame"
}
port {
port = 80
target_port = 8080
}
}
}
module "ingress" {
source = "../../modules/kubernetes/ingress_factory"
# Photo-frame kiosk display — runs in headless browser mode on a TV/frame
# device and pulls images via an Immich API key (no user login). Forward-auth
# would 302 the device to Authentik with no way to complete login.
# auth = "none": Photo-frame kiosk display — headless browser with API key; no user login; forward-auth breaks device automation.
auth = "none"
dns_type = "proxied"
namespace = "immich"
name = "highlights-immich"
tls_secret_name = var.tls_secret_name
service_name = "immich-frame"
}