Skip to content

Instantly share code, notes, and snippets.

@emwalker
Created February 17, 2018 00:46
Show Gist options
  • Save emwalker/3ac89eb01baadbe9ec32642f6a4d4fd0 to your computer and use it in GitHub Desktop.
Save emwalker/3ac89eb01baadbe9ec32642f6a4d4fd0 to your computer and use it in GitHub Desktop.
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: backup-production-database
spec:
schedule: "*/30 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: busybox
image: some-repo/utility:03e7898
args:
- /bin/sh
- -c
- backup-to-s3 some-database
env:
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: utility-secrets
key: utility.aws.access_key_id
- name: AWS_DEFAULT_REGION
value: eu-west-1
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: utility-secrets
key: utility.aws.secret_access_key
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: PGHOST
valueFrom:
secretKeyRef:
name: application-secrets
key: application.postgres.host
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: application-secrets
key: application.postgres.password
- name: PGDATABASE
valueFrom:
configMapKeyRef:
name: namespace-config
key: application.postgres.database
restartPolicy: OnFailure
successfulJobsHistoryLimit: 5
failedJobsHistoryLimit: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment