---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: generate-worldmap
spec:
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3
  concurrencyPolicy: Forbid
  schedule: "50 20 * * *"
  startingDeadlineSeconds: 500
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never
          containers:
          - name: mirrormanager
            image: image-registry.openshift-image-registry.svc:5000/mirrormanager/mirrormanager2:latest
            command:
              - "/opt/app-root/bin/mm2_generate-worldmap"
              - "--output"
              - "/var/lib/mirrormanager/statistics/map/"
            volumeMounts:
              - name: config
                mountPath: "/etc/mirrormanager"
                readOnly: true
              - name: data
                mountPath: "/var/lib/mirrormanager"
          volumes:
            - name: config
              configMap:
                name: config
            - name: data
              persistentVolumeClaim:
                claimName: data
          securityContext:
            supplementalGroups: [1001280000]
---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: get-geoip
spec:
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3
  concurrencyPolicy: Forbid
  schedule: "48 * * * *"
  startingDeadlineSeconds: 500
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never
          containers:
          - name: mirrormanager
            image: image-registry.openshift-image-registry.svc:5000/mirrormanager/mirrormanager2:latest
            command:
              - "curl"
              - "--create-dirs"
              - "--output-dir"
              - "/var/lib/mirrormanager/geoip"
              - "-O"
              - "https://infrastructure.fedoraproject.org/infra/bigfiles/geoip/GeoLite2-City.mmdb"
            volumeMounts:
              - name: data
                mountPath: "/var/lib/mirrormanager"
          volumes:
            - name: data
              persistentVolumeClaim:
                claimName: data
          securityContext:
            supplementalGroups: [1001280000]
# ---
# apiVersion: batch/v1
# kind: CronJob
# metadata:
#   name: sync-crawler-logs
# spec:
#   successfulJobsHistoryLimit: 3
#   failedJobsHistoryLimit: 3
#   concurrencyPolicy: Forbid
#   schedule: "55 * * * *"
#   startingDeadlineSeconds: 500
#   jobTemplate:
#     spec:
#       template:
#         spec:
#           restartPolicy: Never
#           containers:
#           - name: mirrormanager
#             image: mirrormanager2:latest
#             command: ["bash", "/opt/scripts/sync-crawler-logs.sh"]
#             volumeMounts:
#               - name: config
#                 mountPath: "/etc/mirrormanager"
#                 readOnly: true
#               - name: scripts
#                 mountPath: "/opt/scripts"
#                 readOnly: true
#           volumes:
#             - name: config
#               configMap:
#                 name: config
#             - name: scripts
#               configMap:
#                 name: scripts
