apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: transmission
    app.kubernetes.io/version: "3.7"
  name: transmission
  namespace: multimedia
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: transmission
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-container: transmission
      labels:
        app.kubernetes.io/name: transmission
        app.kubernetes.io/version: "3.7"
    spec:
      containers:
      - env:
        - name: TRANSMISSION_ADDR
          value: http://127.0.0.1:9091
        image: metalmatze/transmission-exporter:master
        imagePullPolicy: Always
        name: exporter
        ports:
        - containerPort: 19091
          name: metrics
        resources:
          limits:
            memory: 20Mi
          requests:
            memory: 11Mi
      - envFrom:
        - configMapRef:
            name: transmission-config
            optional: false
        image: haugene/transmission-openvpn:3.7
        name: transmission
        ports:
        - containerPort: 9091
          name: http-api
        readinessProbe:
          failureThreshold: 5
          initialDelaySeconds: 10
          tcpSocket:
            port: http-api
          timeoutSeconds: 10
        resources:
          requests:
            cpu: 200m
            memory: 500Mi
        securityContext:
          allowPrivilegeEscalation: true
          capabilities:
            add:
            - NET_ADMIN
        volumeMounts:
        - mountPath: /data
          name: data
        - mountPath: /download/incomplete
          name: incomplete
        - mountPath: /download/completed
          name: completed
        - mountPath: /config/openvpn-credentials.txt
          name: vpncreds
          subPath: openvpn-credentials.txt
      dnsConfig:
        nameservers:
        - 1.1.1.1
        - 1.0.0.1
      dnsPolicy: None
      restartPolicy: Always
      securityContext:
        sysctls:
        - name: net.ipv4.tcp_adv_win_scale
          value: "4"
      tolerations: []
      volumes:
      - name: vpncreds
        secret:
          secretName: transmission-vpn-creds
      - name: data
        persistentVolumeClaim:
          claimName: transmission-data
      - name: incomplete
        persistentVolumeClaim:
          claimName: torrents-incomplete
      - name: completed
        persistentVolumeClaim:
          claimName: torrents
