apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: api-message-send-cron
  labels:
    project: sob
    layer: api
spec:
  schedule: "0 0 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: api-message-send-cron
              image: eu.gcr.io/aperturedevs/sob-api-php:stable
              command: ["/bin/sh", "-c", "./bin/console app:message:send-bottles"]
              env:
                - name: EVENT_STORE_URL
                  valueFrom:
                    secretKeyRef:
                      name: sob-secret
                      key: api-event-store-url
                - name: RELATIONAL_DATABASE_URL
                  valueFrom:
                    secretKeyRef:
                      name: sob-secret
                      key: api-relational-database-url
                - name: MESSENGER_TRANSPORT_DSN
                  valueFrom:
                    secretKeyRef:
                      name: sob-secret
                      key: api-messenger-transport-dsn
                - name: APP_SECRET
                  valueFrom:
                    secretKeyRef:
                      name: sob-secret
                      key: api-secret
                - name: APP_ENV
                  valueFrom:
                    configMapKeyRef:
                      name: api-configmap
                      key: environment
                - name: CORS_ALLOW_ORIGIN
                  valueFrom:
                    configMapKeyRef:
                      name: api-configmap
                      key: cors
                - name: FRONTEND_URL
                  valueFrom:
                    configMapKeyRef:
                      name: api-configmap
                      key: frontend_url
              resources:
                limits:
                  cpu: "100m"
                  memory: "128Mi"
                requests:
                  cpu: "1m"
                  memory: "128Mi"
          restartPolicy: Never
