apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: mybinder-archive-parser
spec:
  # run every day every hour (in UTC)
  schedule: "0 * * * *"
  # Setting a limit to 0 corresponds to keeping none of the corresponding kind of jobs after they finish.
  successfulJobsHistoryLimit: 0
  failedJobsHistoryLimit: 70
  jobTemplate:
    spec:
      template:
        metadata:
          name: mybinder-archive-parser
        spec:
          restartPolicy: OnFailure
          nodeSelector:
            base: worker  # where database is
          containers:
          - name: mybinder-archive-parser
            image: gesiscss/binder-gallery:cce7976
            command: ["flask"]
            args: ["parse-mybinder-archives", "--with-description", "--excluded-origins", "notebooks-test.gesis.org,", "mybinder"]
            ports:
            - containerPort: 5000
              protocol: TCP
            env:
            - name: FLASK_APP
              value:  "binder_gallery"
            - name: FLASK_ENV
              value:  "production"
            - name: BG_BASE_URL
              value:  "/gallery/"
            - name: BG_APPLICATION_SETTINGS
              value:  "gallery_config_test.Config"
            volumeMounts:
            - name: gallery-config
              mountPath: /binder_gallery/gallery_config_test.py
              subPath: _secret_config_test.py
              readOnly: true
          volumes:
          - name: gallery-config
            secret:
              secretName: gallery-config
