apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: tdarr-node
  labels:
    app.kubernetes.io/controller: node
    app.kubernetes.io/instance: tdarr
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: tdarr
    helm.sh/chart: tdarr-5.0.1
  namespace: tdarr
spec:
  revisionHistoryLimit: 3
  replicas: 3
  podManagementPolicy: OrderedReady
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app.kubernetes.io/controller: node
      app.kubernetes.io/name: tdarr
      app.kubernetes.io/instance: tdarr
  serviceName: tdarr
  template:
    metadata:
      labels:
        app.kubernetes.io/controller: node
        app.kubernetes.io/instance: tdarr
        app.kubernetes.io/name: tdarr
    spec:
      enableServiceLinks: false
      serviceAccountName: tdarr
      automountServiceAccountToken: false
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      nodeSelector:
        intel.feature.node.kubernetes.io/gpu: "true"
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: app.kubernetes.io/instance
                    operator: In
                    values:
                      - node
              topologyKey: kubernetes.io/hostname
      containers:
        - env:
            - name: TZ
              value: America/Chicago
            - name: PUID
              value: "1001"
            - name: PGID
              value: "1001"
            - name: UMASK_SET
              value: "002"
            - name: ffmpegVersion
              value: "6"
            - name: inContainer
              value: "true"
            - name: nodeName
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: serverIP
              value: tdarr-api
            - name: serverPort
              value: "8266"
          image: ghcr.io/haveagitgat/tdarr_node:2.75.01@sha256:db2b52a1a6fb545a9b0a45952d7f1172e1e23979af638845aea2a76ce2e2e7e6
          name: main
          resources:
            limits:
              gpu.intel.com/i915: 1
            requests:
              cpu: 10m
              gpu.intel.com/i915: 1
              memory: 100Mi
          volumeMounts:
            - mountPath: /mnt/store
              name: media
              readOnly: true
            - mountPath: /tcache
              name: transcode-cache
      volumes:
        - name: media
          persistentVolumeClaim:
            claimName: tdarr-nfs-storage
  volumeClaimTemplates:
    - metadata:
        name: transcode-cache
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
        storageClassName: local-path
