-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
31 lines (31 loc) · 1.43 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
apiVersion: batch/v2alpha1
kind: CronJob
metadata:
name: backup
spec:
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 3
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
metadata:
labels:
parent: "cronjobbackup"
spec:
containers:
- name: backup
image: "docker-registry.default.svc:5000/test-waiverdb-backup/waiverdb-backup:latest"
command: ['/bin/bash', '-c', 'echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd && pg_dump -d waiverdb -h waiverdb-test-123-database -p 5432 -U waiverdb -f /var/tmp/waiverdb-backups/$(date +"%Y-%m-%d-%H:%M:%S,%3N").dump && echo "$TEMPORARY_BACKUP_KEY" >> /var/tmp/temporary_backup_key.pem && chmod 400 /var/tmp/temporary_backup_key.pem && scp -i /var/tmp/temporary_backup_key.pem -o "StrictHostKeyChecking no" /var/tmp/waiverdb-backups/* [email protected]:/backups/bareos/backup_upshift/waiverdb-dev']
env:
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: waiverdb-test-123-secret
key: database-password
- name: TEMPORARY_BACKUP_KEY
valueFrom:
secretKeyRef:
name: temporary-upshift-backups
key: temporary-upshift-backups-key.pem
restartPolicy: OnFailure