apiVersion: batch/v1beta1
kind: CronJob
metadata:
  labels:
    app: nextcloud-cron
  name: nextcloud-cron
spec:
  schedule: "*/15 * * * *"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: cronjob
              image: curlimages/curl
              imagePullPolicy: IfNotPresent
              command:
                - sh
                - -c
                - curl -sH host:$(PUBLIC_DOMAIN) http://$(SERVICE_APPLICATION_NAME)/cron.php
          initContainers:
            - name: wait-for-application
              image: curlimages/curl
              imagePullPolicy: IfNotPresent
              command:
                - sh
                - -c
                - until curl -sfH host:$(PUBLIC_DOMAIN) http://$(SERVICE_APPLICATION_NAME)/status.php; do echo waiting for server; sleep 2; done
