---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: immich-microservices
spec:
  replicas: 1
  selector:
    matchLabels:
      app: immich-microservices
  strategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: immich-microservices
        component: microservices
    spec:
      containers:
        - image: "{{ .config.apps.immich.serverImage }}"
          name: immich-microservices
          env:
            - name: REDIS_HOSTNAME
              value: "{{ .config.apps.immich.redisHostname }}"
            - name: DB_HOSTNAME
              value: "{{ .config.apps.immich.dbHostname }}"
            - name: DB_USERNAME
              value: "{{ .config.apps.immich.dbUsername }}"
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: immich-secrets
                  key: dbPassword
            - name: TZ
              value: "{{ .config.apps.immich.timezone }}"
            - name: IMMICH_WORKERS_EXCLUDE
              value: api
          volumeMounts:
            - mountPath: /usr/src/app/upload
              name: immich-storage
              readOnly: false
      volumes:
        - name: immich-storage
          persistentVolumeClaim:
            claimName: immich-pvc
