apiVersion: apps/v1
kind: Deployment
metadata:
    name: immich
    namespace: immich
spec:
    replicas: 1
    selector:
        matchLabels:
            app: immich
    template:
        metadata:
            labels:
                app: immich
        spec:
            hostname: immich
            subdomain: immich
            containers:
              - name: immich-server
                image: ghcr.io/immich-app/immich-server:v1.127.0
                ports:
                  - containerPort: 2283
                  - containerPort: 8081
                    name: metrics
                env:
                  - name: IMMICH_TELEMETRY_INCLUDE
                    value: "all"
                  - name: IMMICH_CONFIG_FILE
                    value: "/usr/src/app/config/immich.json"
                  - name: REDIS_HOSTNAME
                    value: "redis-svc.immich.svc.cluster.local"
                  - name: REDIS_PORT
                    value: "6379"
                  - name: DB_HOSTNAME
                    value: "immich-db-rw.immich.svc.cluster.local"
                  - name: DB_USERNAME
                    valueFrom:
                      secretKeyRef:
                        name: immich-db
                        key: username
                  - name: DB_PASSWORD
                    valueFrom:
                      secretKeyRef:
                        name: immich-db
                        key: password
                volumeMounts:
                  - mountPath: "/usr/src/app/upload"
                    name: immich-upload
                  - mountPath: "/etc/localtime"
                    name: localtime
                    readOnly: true
                  - mountPath: "/usr/src/app/config/immich.json"
                    name: immich-config
                    subPath: immich.json
              - name: immich-machine-learning
                image: ghcr.io/immich-app/immich-machine-learning:v1.126.1
                ports:
                  - containerPort: 3003
                volumeMounts:
                  - mountPath: "/cache"
                    name: immich-model
              - name: redis
                image: redis:7.4.2
                ports:
                  - containerPort: 6379
            volumes:
              - name: immich-upload
                persistentVolumeClaim:
                  claimName: immich-pvc
              - name: immich-model
                persistentVolumeClaim:
                  claimName: immich-model-pvc
              - name: immich-config
                configMap:
                  name: immich-config
              - name: localtime
                hostPath:
                  path: /etc/localtime