---
# Source: seedbox/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: seedbox
  labels:
    app.kubernetes.io/name: seedbox
    app.kubernetes.io/instance: seedbox
    app.kubernetes.io/version: "1.0"
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: seedbox
      app.kubernetes.io/instance: seedbox
  template:
    metadata:
      labels:
        app.kubernetes.io/name: seedbox
        app.kubernetes.io/instance: seedbox
    spec:
      volumes:
      - name: yasr-volume
        persistentVolumeClaim:
          claimName: yasr-volume
      - name: main-volume
        persistentVolumeClaim:
          claimName: main-volume
      - hostPath:
          path: /dev/net/tun
        name: dev-tun
      - hostPath:
          path: /etc/localtime
        name: tz-config
      dnsPolicy: ClusterFirst
      dnsConfig:
        {}
      containers:
      # VPN
      - name: "vpn"
        image: "qmcgaw/gluetun:v3.15.0"
        imagePullPolicy: "IfNotPresent"
        env:
        - name: VPNSP
          value: private internet access
        - name: REGION
          value: CA Toronto
        - name: OPENVPN_USER
          value: ${VPN_USER}
        - name: OPENVPN_PASSWORD
          value: ${VPN_PASSWORD}
        - name: FIREWALL
          value: "off"
        - name: OPENVPN_IPV6
          value: "off"
        - name: TZ
          value: America/New_York
        - name: PORT_FORWARDING
          value: "on"
        - name: HTTPPROXY
          value: "off"
        - name: SHADOWSOCKS
          value: "off"
        securityContext:
          capabilities:
            add: ["NET_ADMIN"]
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - '[ "$(curl -s https://ifconfig.co/city)" != "${VPN_CITY}" ]'
          initialDelaySeconds: 30
          periodSeconds: 60
          timeoutSeconds: 30
          failureThreshold: 2
        resources:
          requests:
            cpu: "100m"
            memory: "250Mi"
          limits:
            cpu: "500m"
            memory: "1500Mi"
        volumeMounts:
        - mountPath: /vpn
          name: yasr-volume
          subPath: configs/openvpn
        - mountPath: /dev/net/tun
          name: dev-tun
        - mountPath: /tmp/gluetun/
          name: yasr-volume
          subPath: configs/transmission/
      # Transmission port forward
      - name: transmission-pia-port-forward
        image: "gandazgul/transmission-pia-port-forward:v318a599"
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            cpu: 50m
            memory: 50Mi
          limits:
            cpu: 50m
            memory: 50Mi
        volumeMounts:
        - mountPath: /data
          name: yasr-volume
          subPath: configs/transmission
        - mountPath: /config
          name: yasr-volume
          subPath: configs/transmission
        - mountPath: /watch
          name: yasr-volume
          subPath: configs/transmission/watch
        - mountPath: /etc/localtime
          name: tz-config
          readOnly: true
      - name: transmission
        image: "linuxserver/transmission:amd64-latest"
        imagePullPolicy: "Always"
        env:
        - name: PGID
          value: "1000"
        - name: PUID
          value: "1000"
        - name: TRANSMISSION_UMASK
          value: "2"
        - name: TZ
          value: America/New_York
        resources:
          requests:
            cpu: "100m"
            memory: "100Mi"
          limits:
            cpu: "1000m"
            memory: "2000Mi"
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - '[ "$(curl -s https://ifconfig.co/city)" != "${VPN_CITY}" ]'
          initialDelaySeconds: 30
          periodSeconds: 60
          timeoutSeconds: 20
          failureThreshold: 1
        readinessProbe:
          failureThreshold: 3
          initialDelaySeconds: 10
          periodSeconds: 2
          successThreshold: 2
          tcpSocket:
            port: 9091
          timeoutSeconds: 2
        volumeMounts:
        - mountPath: /data
          name: yasr-volume
          subPath: configs/transmission
        - mountPath: /config
          name: yasr-volume
          subPath: configs/transmission
        - mountPath: /watch
          name: yasr-volume
          subPath: configs/transmission/watch
        - mountPath: /etc/localtime
          name: tz-config
          readOnly: true
        ports:
        - name: trs-http
          containerPort: 9091
          protocol: TCP
        - name: 51413-tcp
          containerPort: 51413
          protocol: TCP
        - name: 51412-udp
          containerPort: 51413
          protocol: UDP
      # Jackett
      - name: "jackett"
        image: "linuxserver/jackett:amd64-latest"
        imagePullPolicy: "Always"
        env:
        - name: PUID
          value: "1000"
        - name: PGID
          value: "1000"
        - name: TZ
          value: America/New_York
        resources:
          requests:
            cpu: "100m"
            memory: "100Mi"
          limits:
            cpu: "500m"
            memory: "1000Mi"
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - '[ "$(curl -s https://ifconfig.co/city)" != "${VPN_CITY}" ]'
          initialDelaySeconds: 30
          periodSeconds: 60
          timeoutSeconds: 30
          failureThreshold: 2
        readinessProbe:
          failureThreshold: 3
          initialDelaySeconds: 30
          periodSeconds: 2
          successThreshold: 2
          tcpSocket:
            port: jackett-http
          timeoutSeconds: 2
        volumeMounts:
        - mountPath: /config
          name: yasr-volume
          subPath: configs/jackett
        - mountPath: /downloads
          name: yasr-volume
          subPath: configs/jackett/downloads
        ports:
        - name: jackett-http
          containerPort: 9117
          protocol: TCP
      # Sonarr
      - name: "sonarr"
        image: "linuxserver/sonarr:amd64-latest"
        imagePullPolicy: "Always"
        env:
        - name: PUID
          value: "1000"
        - name: PGID
          value: "1000"
        - name: TZ
          value: America/New_York
        resources:
          requests:
            cpu: "100m"
            memory: "100Mi"
          limits:
            cpu: "1000m"
            memory: "2000Mi"
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - '[ "$(curl -s https://ifconfig.co/city)" != "${VPN_CITY}" ]'
          initialDelaySeconds: 30
          periodSeconds: 60
          timeoutSeconds: 30
          failureThreshold: 2
        readinessProbe:
          failureThreshold: 3
          initialDelaySeconds: 10
          periodSeconds: 2
          successThreshold: 2
          tcpSocket:
            port: sonarr-http
          timeoutSeconds: 2
        ports:
        - name: sonarr-http
          containerPort: 8989
          protocol: TCP
      # Radarr
      - name: "radarr"
        image: "linuxserver/radarr:amd64-latest"
        imagePullPolicy: "Always"
        env:
        - name: PUID
          value: "1000"
        - name: PGID
          value: "1000"
        - name: TZ
          value: America/New_York
        resources:
          requests:
            cpu: "100m"
            memory: "100Mi"
          limits:
            cpu: "1000m"
            memory: "2000Mi"
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - '[ "$(curl -s https://ifconfig.co/city)" != "${VPN_CITY}" ]'
          initialDelaySeconds: 30
          periodSeconds: 60
          timeoutSeconds: 30
          failureThreshold: 2
        readinessProbe:
          failureThreshold: 3
          initialDelaySeconds: 10
          periodSeconds: 2
          successThreshold: 2
          tcpSocket:
            port: radarr-http
          timeoutSeconds: 2
        ports:
        - name: radarr-http
          containerPort: 7878
          protocol: TCP
      # Prowlarr
      - name: prowlarr
        image: linuxserver/prowlarr:amd64-1.8.1253
        imagePullPolicy: Always
        env:
        - name: PUID
          value: "1000"
        - name: PGID
          value: "1000"
        - name: TZ
          value: America/New_York
        resources:
          requests:
            cpu: "100m"
            memory: "100Mi"
          limits:
            cpu: "1000m"
            memory: "2000Mi"
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - '[ "$(curl -s https://ifconfig.co/city)" != "${VPN_CITY}" ]'
          initialDelaySeconds: 30
          periodSeconds: 60
          timeoutSeconds: 30
          failureThreshold: 2
        readinessProbe:
          failureThreshold: 3
          initialDelaySeconds: 10
          periodSeconds: 2
          successThreshold: 2
          tcpSocket:
            port: prowlarr-http
          timeoutSeconds: 2
        ports:
        - name: prowlarr-http
          containerPort: 9696
          protocol: TCP
        volumeMounts:
        - mountPath: /config
          name: yasr-volume
          subPath: configs/prowlarr
