mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-05-11 18:36:53 +08:00
Add Koschei db-cleanup CronJob
This commit is contained in:
@@ -55,3 +55,19 @@
|
||||
memory: 4096
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Apply CronJob
|
||||
include_role: name=openshift/object
|
||||
vars:
|
||||
template: cronjob.yml
|
||||
objectname: "{{ item.name }}-cronjob.yml"
|
||||
name: "{{ item.name }}"
|
||||
schedule: "{{ item.schedule }}"
|
||||
command: "{{ item.command }}"
|
||||
with_items:
|
||||
- name: db-cleanup
|
||||
# XXX for testing we run this job every minute
|
||||
schedule: "* * * * *"
|
||||
command: "koschei-admin cleanup --older-than 6"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
24
roles/openshift-apps/koschei/templates/cronjob.yml
Normal file
24
roles/openshift-apps/koschei/templates/cronjob.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: batch/v1beta1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: "cron-{{name}}"
|
||||
spec:
|
||||
concurrencyPolicy: Forbid
|
||||
schedule: "{{schedule}}"
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: "cron-{{name}}"
|
||||
image: quay.io/koschei/koschei:latest
|
||||
command: ["/bin/bash", "-euxc", "{{command}}"]
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/koschei
|
||||
readOnly: true
|
||||
restartPolicy: Never
|
||||
volumes:
|
||||
- name: config
|
||||
secret:
|
||||
secretName: backend-config
|
||||
Reference in New Issue
Block a user