apiVersion: v1
kind: Namespace
metadata:
  name: tdarr-node
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tdarr-node
  namespace: tdarr-node
  labels:
    app: tdarr-node
    applications.app.bytetrade.io/name: tdarr-node
    applications.app.bytetrade.io/owner: vishinator
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: tdarr-node
  template:
    metadata:
      labels:
        app: tdarr-node
        applications.app.bytetrade.io/name: tdarr-node
        applications.app.bytetrade.io/owner: vishinator
        io.bytetrade.app: "true"
    spec:
      runtimeClassName: nvidia
      containers:
        - name: tdarr-node
          image: ghcr.io/haveagitgat/tdarr_node@sha256:dc23becc667f77d2489b1042REDACTED_GITEA_TOKEN
          env:
            - name: PUID
              value: "1029"
            - name: PGID
              value: "100"
            - name: TZ
              value: "America/Los_Angeles"
            - name: UMASK
              value: "022"
            - name: nodeName
              value: "Olares"
            - name: serverIP
              value: "192.168.0.200"
            - name: serverPort
              value: "8266"
            - name: inContainer
              value: "true"
            - name: ffmpegVersion
              value: "6"
            - name: NVIDIA_VISIBLE_DEVICES
              value: "all"
            - name: NVIDIA_DRIVER_CAPABILITIES
              value: "all"
          resources:
            requests:
              cpu: "500m"
              memory: "2Gi"
            limits:
              cpu: "8"
              memory: "16Gi"
          volumeMounts:
            - name: config
              mountPath: /app/configs
            - name: logs
              mountPath: /app/logs
            - name: media
              mountPath: /media
            - name: cache-temp
              mountPath: /temp
            - name: cache
              mountPath: /cache
      volumes:
        - name: config
          hostPath:
            path: /var/olares/userdata/tdarr-node/configs
            type: DirectoryOrCreate
        - name: logs
          hostPath:
            path: /var/olares/userdata/tdarr-node/logs
            type: DirectoryOrCreate
        - name: media
          hostPath:
            path: /mnt/atlantis_media
            type: Directory
        - name: cache-temp
          hostPath:
            path: /mnt/atlantis_cache
            type: Directory
        - name: cache
          hostPath:
            path: /mnt/atlantis_cache
            type: Directory
---
apiVersion: crd.projectcalico.org/v1
kind: GlobalNetworkPolicy
metadata:
  name: allow-lan-to-tdarr
spec:
  order: 100
  selector: app == 'tdarr-node'
  types:
    - Ingress
    - Egress
  ingress:
    - action: Allow
      source:
        nets:
          - 192.168.0.0/24
  egress:
    - action: Allow
