apiVersion: apps/v1
kind: Deployment
metadata:
  name: qbittorrent
  labels:
    app.kubernetes.io/name: qbittorrent
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: qbittorrent
  template:
    metadata:
      labels:
        app.kubernetes.io/name: qbittorrent
    spec:
      containers:
        - name: qbittorrent
          image: linuxserver/qbittorrent:latest
          imagePullPolicy: Always
          ports:
            - name: "http"
              containerPort: 8080
              protocol: TCP
            - name: "bt-tcp"
              containerPort: 31136
              protocol: TCP
            - name: "bt-udp"
              containerPort: 31136
              protocol: UDP
          volumeMounts:
            - name: qbittorrent-config
              mountPath: /config
            - name: data
              mountPath: /data
            - name: mediaserver
              mountPath: /mediaserver
          envFrom:
            - configMapRef:
                name: mediaserver-permissions
          resources:
            requests:
              cpu: "500m"
              memory: "2Gi"
            limits:
              cpu: "2000m"
              memory: "6Gi"
          readinessProbe:
            httpGet:
              path: /
              port: http
              scheme: HTTP
            periodSeconds: 10
            failureThreshold: 3
          livenessProbe:
            httpGet:
              path: /
              port: http
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 10
            failureThreshold: 5
      volumes:
        - name: qbittorrent-config
          persistentVolumeClaim:
            claimName: qbittorrent-config
        - name: data
          emptyDir: {}
        - name: mediaserver
          persistentVolumeClaim:
            claimName: mediaserver
