apiVersion: apps/v1
kind: Deployment
metadata:
  name: lingarr
  namespace: stack-arr
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lingarr
  template:
    metadata:
      labels:
        app: lingarr
    spec:
      containers:
        - name: lingarr
          image: lingarr/lingarr:main
          ports:
            - containerPort: 9876
          env:
            - name: TZ
              value: "UTC"
            - name: ASPNETCORE_URLS
              value: "http://+:9876"
            - name: WHISPER_BASE_URL
              value: "http://whisperasr-service.stack-arr.svc.cluster.local:9000"
            - name: SOURCE_LANGUAGE
              value: "auto"
            - name: TARGET_LANGUAGE
              value: "pt"
            - name: DB_CONNECTION
              value: postgresql 
            - name: DB_HOST
              value: 'stolon-proxy-service.postgresql.svc.cluster.local'
            - name: DB_PORT
              value: '5432'
            - name: DB_USERNAME
              valueFrom:
                secretKeyRef:
                  name: lingarr-secret
                  key: username
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: lingarr-secret
                  key: password
            - name: DB_DATABASE
              valueFrom:
                secretKeyRef:
                  name: lingarr-secret
                  key: maindb
          volumeMounts:
            - name: config
              mountPath: /app/config
            - name: runtimeconfig
              mountPath: /app/Lingarr.Server.runtimeconfig.json
              subPath: Lingarr.Server.runtimeconfig.json
              readOnly: true
            - name: tv
              mountPath: /tv
            - name: anime
              mountPath: /anime
      volumes:
      - name: config
        persistentVolumeClaim:
          claimName: lingarr-config-pvc
      - name: runtimeconfig
        configMap:
          name: lingarr-configmap
      - name: tv
        persistentVolumeClaim:
          claimName: sonarr-tv-pvc
      - name: anime
        persistentVolumeClaim:
          claimName: sonarr-anime-pvc
