From 3f190c834f0e11db5d902c1509ed536c8fc474f0 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Feb 22 2024 16:03:44 +0000 Subject: MM: those cron jobs are templates Signed-off-by: Aurélien Bompard --- diff --git a/playbooks/openshift-apps/mirrormanager.yml b/playbooks/openshift-apps/mirrormanager.yml index 9d5ca53..b3820b6 100644 --- a/playbooks/openshift-apps/mirrormanager.yml +++ b/playbooks/openshift-apps/mirrormanager.yml @@ -127,11 +127,11 @@ # objectname: cron.yml - role: openshift/object app: mirrormanager - file: cron-crawler.yml + template: cron-crawler.yml objectname: cron-crawler.yml - role: openshift/object app: mirrormanager - file: cron-propagation.yml + template: cron-propagation.yml objectname: cron-propagation.yml - role: openshift/start-build diff --git a/roles/openshift-apps/mirrormanager/files/cron-crawler.yml b/roles/openshift-apps/mirrormanager/files/cron-crawler.yml deleted file mode 100644 index 61b7f29..0000000 --- a/roles/openshift-apps/mirrormanager/files/cron-crawler.yml +++ /dev/null @@ -1,41 +0,0 @@ -# -### Crawler cron jobs -# -{% for cronjob in mirrormanager_cron_crawler %} ---- -# Category: {{ cronjob.category }} -apiVersion: batch/v1 -kind: CronJob -metadata: - name: crawler-{{ cronjob.category|lower|replace(" ", "-") }} -spec: - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - concurrencyPolicy: Forbid - schedule: "{{ cronjob.schedule }}" - 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_crawler" - - "--category" - - "{{ cronjob.category }}" - - "--threads" - - "{{ cronjob.threads }}" - - "--timeout-minutes" - - "240" - volumeMounts: - - name: config - mountPath: "/etc/mirrormanager" - readOnly: true - volumes: - - name: config - configMap: - name: config -{% endfor %} diff --git a/roles/openshift-apps/mirrormanager/files/cron-propagation.yml b/roles/openshift-apps/mirrormanager/files/cron-propagation.yml deleted file mode 100644 index dcc568c..0000000 --- a/roles/openshift-apps/mirrormanager/files/cron-propagation.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: propagation-check-current -spec: - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - concurrencyPolicy: Forbid - schedule: "27 */2 * * *" - 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_crawler" - - "--threads" - - "50" - - "propagation" - volumeMounts: - - name: config - mountPath: "/etc/mirrormanager" - readOnly: true - volumes: - - name: config - configMap: - name: config ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: propagation-check-centos-9 -spec: - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - concurrencyPolicy: Forbid - schedule: "44 */2 * * *" - 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_crawler" - - "--threads" - - "50" - - "propagation" - - "--product" - - "CentOS" - - "--version" - - "9-stream" - volumeMounts: - - name: config - mountPath: "/etc/mirrormanager" - readOnly: true - volumes: - - name: config - configMap: - name: config ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: propagation-expire-stats -spec: - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - concurrencyPolicy: Forbid - schedule: "10 2,18 * * *" - 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_expire-stats" - volumeMounts: - - name: config - mountPath: "/etc/mirrormanager" - readOnly: true - volumes: - - name: config - configMap: - name: config diff --git a/roles/openshift-apps/mirrormanager/templates/cron-crawler.yml b/roles/openshift-apps/mirrormanager/templates/cron-crawler.yml new file mode 100644 index 0000000..61b7f29 --- /dev/null +++ b/roles/openshift-apps/mirrormanager/templates/cron-crawler.yml @@ -0,0 +1,41 @@ +# +### Crawler cron jobs +# +{% for cronjob in mirrormanager_cron_crawler %} +--- +# Category: {{ cronjob.category }} +apiVersion: batch/v1 +kind: CronJob +metadata: + name: crawler-{{ cronjob.category|lower|replace(" ", "-") }} +spec: + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 3 + concurrencyPolicy: Forbid + schedule: "{{ cronjob.schedule }}" + 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_crawler" + - "--category" + - "{{ cronjob.category }}" + - "--threads" + - "{{ cronjob.threads }}" + - "--timeout-minutes" + - "240" + volumeMounts: + - name: config + mountPath: "/etc/mirrormanager" + readOnly: true + volumes: + - name: config + configMap: + name: config +{% endfor %} diff --git a/roles/openshift-apps/mirrormanager/templates/cron-propagation.yml b/roles/openshift-apps/mirrormanager/templates/cron-propagation.yml new file mode 100644 index 0000000..dcc568c --- /dev/null +++ b/roles/openshift-apps/mirrormanager/templates/cron-propagation.yml @@ -0,0 +1,97 @@ +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: propagation-check-current +spec: + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 3 + concurrencyPolicy: Forbid + schedule: "27 */2 * * *" + 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_crawler" + - "--threads" + - "50" + - "propagation" + volumeMounts: + - name: config + mountPath: "/etc/mirrormanager" + readOnly: true + volumes: + - name: config + configMap: + name: config +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: propagation-check-centos-9 +spec: + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 3 + concurrencyPolicy: Forbid + schedule: "44 */2 * * *" + 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_crawler" + - "--threads" + - "50" + - "propagation" + - "--product" + - "CentOS" + - "--version" + - "9-stream" + volumeMounts: + - name: config + mountPath: "/etc/mirrormanager" + readOnly: true + volumes: + - name: config + configMap: + name: config +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: propagation-expire-stats +spec: + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 3 + concurrencyPolicy: Forbid + schedule: "10 2,18 * * *" + 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_expire-stats" + volumeMounts: + - name: config + mountPath: "/etc/mirrormanager" + readOnly: true + volumes: + - name: config + configMap: + name: config