apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: qbittorrent-app
  namespace: qbittorrent-system

spec:
  serviceName: qbittorrent-app-service
  selector:
    matchLabels:
      app: qbittorrent-app
  replicas: 1
  template:
    metadata:
      labels:
        app: qbittorrent-app
    spec:
      containers:
        - name: qbittorrent
          image: ghcr.io/linuxserver/qbittorrent
          ports:
            - containerPort: 6881
              name: udp-connect
              protocol: UDP
            - containerPort: 6881
              name: tcp-connect
              protocol: TCP
            - containerPort: 8080
              name: web
              protocol: TCP
          volumeMounts:
            - name: qbittorrent-config-mount
              mountPath: /config
              subPath: programs/qbittorrent
            - name: qbittorrent-downloads-mount
              mountPath: /downloads
              subPath: NAS
          envFrom:
            - configMapRef:
                name: qbittorrent-config
      volumes:
      - name: qbittorrent-config-mount
        persistentVolumeClaim:
          claimName: qbittorrent-config-pvc
      - name: qbittorrent-downloads-mount
        persistentVolumeClaim:
          claimName: qbittorrent-downloads-pvc