apiVersion: apps/v1
kind: Deployment
metadata:
  name: peertube
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: peertube
      app.kubernetes.io/part-of: peertube
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: peertube
        app.kubernetes.io/part-of: peertube
    spec:
      containers:
        - env:
            - name: OPENDKIM_DOMAINS
              valueFrom:
                configMapKeyRef:
                  key: OPENDKIM_DOMAINS
                  name: env
            - name: OPENDKIM_RequireSafeKeys
              valueFrom:
                configMapKeyRef:
                  key: OPENDKIM_RequireSafeKeys
                  name: env
            - name: PEERTUBE_ADMIN_EMAIL
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_ADMIN_EMAIL
                  name: env
            - name: PEERTUBE_DB_HOSTNAME
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_DB_HOSTNAME
                  name: env
            - name: PEERTUBE_DB_PASSWORD
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_DB_PASSWORD
                  name: env
            - name: PEERTUBE_DB_SSL
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_DB_SSL
                  name: env
            - name: PEERTUBE_DB_USERNAME
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_DB_USERNAME
                  name: env
            - name: PEERTUBE_SMTP_DISABLE_STARTTLS
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_DISABLE_STARTTLS
                  name: env
            - name: PEERTUBE_SMTP_FROM
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_FROM
                  name: env
            - name: PEERTUBE_SMTP_HOSTNAME
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_HOSTNAME
                  name: env
            - name: PEERTUBE_SMTP_PORT
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_PORT
                  name: env
            - name: PEERTUBE_SMTP_TLS
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_TLS
                  name: env
            - name: PEERTUBE_TRUST_PROXY
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_TRUST_PROXY
                  name: env
            - name: PEERTUBE_WEBSERVER_HOSTNAME
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_WEBSERVER_HOSTNAME
                  name: env
            - name: POSTFIX_myhostname
              valueFrom:
                configMapKeyRef:
                  key: POSTFIX_myhostname
                  name: env
            - name: POSTGRES_DB
              valueFrom:
                configMapKeyRef:
                  key: POSTGRES_DB
                  name: env
            - name: POSTGRES_PASSWORD
              valueFrom:
                configMapKeyRef:
                  key: POSTGRES_PASSWORD
                  name: env
            - name: POSTGRES_USER
              valueFrom:
                configMapKeyRef:
                  key: POSTGRES_USER
                  name: env
          image: chocobozzz/peertube:production-bullseye
          name: peertube
          ports:
            - containerPort: 1935
            - containerPort: 9000
          resources:
            limits:
              cpu: 250m
              memory: 400Mi
            requests:
              cpu: 50m
              memory: 200Mi
          volumeMounts:
            - mountPath: /app/client/dist
              name: peertube-claim0
            - mountPath: /data
              name: peertube-claim1
            - mountPath: /data/logs
              name: peertube-claim2
            - mountPath: /data/tmp
              name: peertube-claim3
            - mountPath: /config
              name: peertube-claim4
      volumes:
        - name: peertube-claim0
          hostPath:
            path: /var/lib/peertube_assets
            type: Directory
        - name: peertube-claim1
          hostPath:
            path: /srv/peertube
            type: Directory
        - name: peertube-claim2
          hostPath:
            path: /var/log/peertube
            type: Directory
        - name: peertube-claim3
          hostPath:
            path: /var/lib/peertube/tmp
            type: Directory
        - name: peertube-claim4
          hostPath:
            path: /var/lib/peertube/config
            type: Directory
