---
kind: Service
apiVersion: v1
metadata:
  name: aria2-pro-svc
  namespace: default
spec:
  selector:
    app: aria2-pro
  type: ClusterIP
  ports:
    - port: 6800
      targetPort: 6800
      name: http

---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: aria2-pro
  namespace: default
spec:
  selector:
    matchLabels:
      app: aria2-pro
  replicas: 1
  template:
    metadata:
      labels:
        app: aria2-pro
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/hostname
                    operator: In
                    values:
                      - master-s0
      restartPolicy: Always
      containers:
        - name: aria2-pro
          image: p3terx/aria2-pro:202108221156
          imagePullPolicy: IfNotPresent
          # https://hub.docker.com/r/p3terx/aria2-pro
          env:
            - name: RPC_SECRET
              value: loveff.23
            - name: TZ
              value: Asia/Shanghai
            - name: RPC_PORT
              value: '6800'
            - name: IPV6_MODE
              value: 'false'
            - name: UPDATE_TRACKERS
              value: 'false'
            - name: LISTEN_PORT # Set TCP/UDP port number for BitTorrent/DHT listen.
              value: '6888'
            - name: PUID
              value: '5001'
            - name: PGID
              value: '5001'
          volumeMounts:
            - mountPath: /config
              subPath: aria2-config
              name: aria2-pro-pv
            - mountPath: /cloudreve/aria2-downloads
              subPath: aria2-downloads
              name: aria2-pro-pv
          ports:
            - containerPort: 6800
              name: http
      volumes:
        - name: aria2-pro-pv
#          hostPath:
#            path: /data/k8s/local-pv/
          persistentVolumeClaim:
            claimName: cloudreve-pvc
