---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: cron
    app.kubernetes.io/part-of: nextcloud
    app.kubernetes.io/version: 22.0.0
  name: cron
  namespace: nextcloud
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: cron
      app.kubernetes.io/part-of: nextcloud
  replicas: 1
  revisionHistoryLimit: 3
  template:
    metadata:
      labels:
        app.kubernetes.io/name: cron
        app.kubernetes.io/part-of: nextcloud
        app.kubernetes.io/version: 22.0.0
    spec:
      containers:
      - envFrom:
        - configMapRef:
            name: nextcloud-envs
        - secretRef:
            name: mysql-creds
        image: nextcloud:22.0.0-fpm
        name: cron
        command:
        - /cron.sh
        volumeMounts:
        - name: php-config
          mountPath: /etc/php/conf.d
        - name: web
          mountPath: /var/www/html
        - name: apps
          mountPath: /var/www/html/custom_apps
        - name: theme
          mountPath: /var/www/html/themes/mytheme
        - name: config
          mountPath: /var/www/html/config
        - name: data
          mountPath: /var/www/html/data
        - name: cron
          mountPath: /var/spool/cron/crontabs
        resources:
          requests:
            cpu: 150m
            memory: 50Mi
      restartPolicy: Always
      nodeSelector:
        kubernetes.io/arch: amd64  # TODO: consider removing
      volumes:
      - name: php-config
        configMap:
          name: php-config
      - name: cron
        configMap:
          name: cron-config
      - name: data
        persistentVolumeClaim:
          claimName: nextcloud-data
      - name: web
        persistentVolumeClaim:
          claimName: nextcloud-files
      - name: apps
        persistentVolumeClaim:
          claimName: nextcloud-apps
      - name: theme
        persistentVolumeClaim:
          claimName: nextcloud-theme
      - name: config
        persistentVolumeClaim:
          claimName: nextcloud-config
