---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tdarr-worker
  namespace: media
  labels:
    app.kubernetes.io/name: tdarr-worker
    app.kubernetes.io/instance: tdarr-worker
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: tdarr-worker
      app.kubernetes.io/instance: tdarr-worker
  template:
    metadata:
      labels:
        app.kubernetes.io/name: tdarr-worker
        app.kubernetes.io/instance: tdarr-worker
    spec:
      serviceAccountName: default
      automountServiceAccountToken: true
      dnsPolicy: ClusterFirst
      enableServiceLinks: true
      containers:
        - env:
            - name: TZ
              value: America/New_York
            - name: nodeID
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: nodeIP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: serverIP
              value: tdarr
            - name: serverPort
              value: "8266"
            - name: ffmpegPath
              value: /usr/bin/ffmpeg
            - name: PUID
              value: "1000"
            - name: PGID
              value: "1000"
          image: haveagitgat/tdarr_node:2.00.18
          imagePullPolicy: IfNotPresent
          name: node
          volumeMounts:
            - mountPath: /media
              name: media
            - mountPath: /shared
              name: shared
          livenessProbe:
            tcpSocket:
              port: 8265
            initialDelaySeconds: 0
            failureThreshold: 3
            timeoutSeconds: 1
            periodSeconds: 10
          readinessProbe:
            tcpSocket:
              port: 8265
            initialDelaySeconds: 0
            failureThreshold: 3
            timeoutSeconds: 1
            periodSeconds: 10
          startupProbe:
            tcpSocket:
              port: 8265
            initialDelaySeconds: 0
            failureThreshold: 30
            timeoutSeconds: 1
            periodSeconds: 5
          resources:
            limits:
              cpu: 2000m
              memory: 1024Mi
            requests:
              cpu: 500m
              memory: 218Mi
      volumes:
        - name: media
          nfs:
            path: /tank/media
            server: nas-1.scr1.rabbito.tech
        - name: shared
          emptyDir: {}
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - preference:
                matchExpressions:
                  - key: feature.node.kubernetes.io/custom-intel-10g
                    operator: In
                    values:
                      - "true"
              weight: 1
