apiVersion: apps/v1
kind: Deployment
metadata:
  name: opencast-worker
  namespace: opencast
  labels:
    edu.my.srv: opencast-worker
spec:
  replicas: 1
  minReadySeconds: 60
  strategy:
    type: Recreate
  selector:
    matchLabels:
      edu.my.srv: opencast-worker
  template:
    metadata:
      labels:
        edu.my.srv: opencast-worker
    spec:
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      initContainers:
        - name: data-init
          image: busybox
          command: ["sh", "-c", "chown -R 800:800 /data"]
          volumeMounts:
            - name: data
              mountPath: /data
      containers:
        - name: opencast-worker
          image: quay.io/opencast/worker:5.0
          env:
            - name: ORG_OPENCASTPROJECT_DB_VENDOR
              value: "MySQL"
            - name: JAVA_MIN_MEM
              value: "512M"
            - name: JAVA_MAX_MEM
              value: "7G"
          volumeMounts:
            - name: opencast-config
              mountPath: /etc/opencast
            - name: data
              mountPath: /data
          resources:
            requests:
              memory: "1Gi"
              cpu: "1"
            limits:
              memory: "7Gi"
              cpu: "4"
      volumes:
        - name: opencast-config
          configMap:
            name: opencast-config
            items:
              - key: custom.properties-worker
                path: custom.properties
              - key: mh_default_org.cfg
                path: org.opencastproject.organization-mh_default_org.cfg
        - name: data
          persistentVolumeClaim:
            claimName: data
