#---------------------------------------------------------------
#                             CRON JOBS
#---------------------------------------------------------------
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  namespace: sentry
  name: geoip-job
spec:
  schedule: "0 0 * * 3" #Every Wed at midnight.
  successfulJobsHistoryLimit: 0
  failedJobsHistoryLimit: 3
  startingDeadlineSeconds: 100
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never

          containers:
            - name: geoip-job
              image: maxmindinc/geoipupdate
              imagePullPolicy: IfNotPresent

              envFrom:
                - configMapRef:
                    name: geoip

              command:
                - sh
                - -exc
                - |
                  geoipupdate --database-directory /data --config-file /etc/geoip/GeoIP.conf --verbose

              volumeMounts:
                - name: sentry-data
                  mountPath: /data
                - name: geoip-configuration
                  mountPath: /etc/geoip

          volumes:
            - name: sentry-data
              persistentVolumeClaim:
                claimName: sentry-data
            - name: geoip-configuration
              configMap:
                name: geoip

