apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: drupal-cron
spec:
  suspend: false
  schedule: "@hourly"
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 1000
  successfulJobsHistoryLimit: 10
  failedJobsHistoryLimit: 10
  jobTemplate:
    spec:
      backoffLimit: 2
      template:
        spec:
          restartPolicy: Never
          containers:
            - name: php
              image: php
              imagePullPolicy: IfNotPresent
              args:
                - vendor/bin/drush -r app cron
              command:
                - /bin/sh
                - -c
              env:
                - name: PHP_MEMORY_LIMIT
                  value: 512Mi
              resources:
                requests:
                  cpu:    250m
                  memory: 512Mi
                limits:
                  cpu:    "1"
                  memory: 512Mi
              securityContext:
                readOnlyRootFilesystem: true
              volumeMounts:
                - name: config
                  mountPath: /etc/drupal
                  readOnly: true
                - name: public
                  mountPath: /data/app/sites/default/files
                - name: private
                  mountPath: /mnt/private
                - name: temporary
                  mountPath: /mnt/temporary
          volumes:
            - name: config
              configMap:
                defaultMode: 420
                name: drupal
            - name: public
              persistentVolumeClaim:
                claimName: drupal-public
            - name: private
              persistentVolumeClaim:
                claimName: drupal-private
            - name: temporary
              persistentVolumeClaim:
                claimName: drupal-temporary