apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: batch-job
  namespace: batch
spec:
  schedule: "0 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: batch-job
              image: shibui/ml-system-in-actions:batch_pattern_batch_0.0.1
              env:
                - name: MYSQL_DATABASE
                  value: sample_db
                - name: MYSQL_USER
                  value: user
                - name: MYSQL_PASSWORD
                  value: password
                - name: MYSQL_PORT
                  value: "3306"
                - name: MYSQL_SERVER
                  value: mysql.batch.svc.cluster.local
              command:
                - python
                - -m
                - src.task.job
              resources:
                requests:
                  cpu: 1000m
                  memory: "1000Mi"
          restartPolicy: OnFailure
