Add Koschei db-cleanup CronJob

This commit is contained in:
Mikolaj Izdebski
2019-02-06 11:38:15 +01:00
parent c4abffaa7b
commit 26e923994a
2 changed files with 40 additions and 0 deletions

View File

@@ -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 }}"

View 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