Last active
June 25, 2018 10:32
-
-
Save lfaoro/4cdcbba3491080d887e67410600b7a1b to your computer and use it in GitHub Desktop.
batch-sql-backup.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1beta1 | |
kind: CronJob | |
metadata: | |
name: batch-sql-backup | |
spec: | |
schedule: "* */60 * * *" | |
concurrencyPolicy: Forbid | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
volumes: | |
- name: cloudsql-instance-credentials | |
secret: | |
secretName: cloudsql-instance-credentials | |
containers: | |
- name: backup-sql | |
image: google/cloud-sdk:latest | |
command: ["/bin/sh", "-c"] | |
args: ["gcloud auth activate-service-account {{ .Values.cloudSQLServiceAccount }} --key-file=/secrets/cloudsql/credentials.json && gcloud config set project {{ .Values.projectID }} && gcloud sql backups create -i {{ .Values.cloudSQLName }}"] | |
volumeMounts: | |
- name: cloudsql-instance-credentials | |
mountPath: /secrets/cloudsql | |
readOnly: true | |
restartPolicy: OnFailure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment