apiVersion: apps/v1
kind: Deployment
metadata:
  name: qbitty
  namespace: arr
  labels:
    app: qbitty
spec:
  replicas: 1
  selector:
    matchLabels:
      app: qbitty
  template:
    metadata:
      labels:
        app: qbitty
    spec:
      containers:
        - name: qbitty
          image: ghcr.io/hotio/qbittorrent@sha256:3c32e5d21f5e83558a71767dfdf7f39fe5379548829be4723270cda61f08fd56
          imagePullPolicy: IfNotPresent
          env:
            - name: VPN_ENABLED
              value: "true"
            - name: VPN_CONF
              value: "wg0"
            - name: VPN_PROVIDER
              value: "proton"
            - name: VPN_KEEP_LOCAL_DNS
              value: "false"
            - name: VPN_AUTO_PORT_FORWARD
              value: "true"
            - name: VPN_LAN_NETWORK
              valueFrom:
                secretKeyRef:
                  name: lan-network
                  key: lan-network
            - name: VPN_LAN_LEAK_ENABLED
              value: "false"
            - name: VPN_FIREWALL_TYPE
              value: "auto"
            - name: PRIVOXY_ENABLED
              value: "false"
            - name: WEBUI_PORT
              value: "8080"
            - name: VPN_HEALTHCHECK_ENABLED
              value: "false"
            - name: UNBOUND_ENABLED
              value: "false"
          resources:
            requests:
              memory: "256Mi"
              cpu: "100m"
            limits:
              memory: "1Gi"
              cpu: "5000m"
          volumeMounts:
            - mountPath: /config
              name: qbitty-config
            - mountPath: /data
              name: nas
            - mountPath: /config/wireguard/
              name: wireguard-config
            - mountPath: /incomplete
              name: qbitty-incomplete
          securityContext:
            capabilities:
              add: ["NET_ADMIN"]
          ports:
            - containerPort: 8080
              name: webui
              protocol: TCP
      volumes:
        - name: nas
          nfs:
            path: /mnt/thePool/thePoolShare
            server: 10.0.0.10
        - name: qbitty-config
          persistentVolumeClaim:
            claimName: qbitty-config
        - name: wireguard-config
          secret:
            secretName: qbitty-wireguard
        - name: qbitty-incomplete
          emptyDir:
            sizeLimit: 100Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: qbitty-config
  namespace: arr
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: longhorn