| apiVersion: batch/v1beta1 |
| kind: CronJob |
| metadata: |
| name: firestore-export-everything-weekly |
| spec: |
| schedule: "0 5 * * 0" |
| concurrencyPolicy: "Forbid" |
| jobTemplate: |
| spec: |
| template: |
| spec: |
| restartPolicy: Never |
| automountServiceAccountToken: false |
| securityContext: |
| runAsUser: 2000 # aka skia |
| fsGroup: 2000 # aka skia |
| containers: |
| - name: cloud-sdk |
| image: google/cloud-sdk:latest |
| command: |
| - "/bin/sh" |
| - "-c" |
| - "gcloud auth activate-service-account --key-file=$(GOOGLE_APPLICATION_CREDENTIALS) |
| && gcloud beta firestore export --project=skia-firestore --async |
| gs://skia-firestore-backup/everything/`date --utc +%Y-%m-%dT%H:%M:%SZ`" |
| volumeMounts: |
| - name: firestore-export-sa |
| mountPath: /var/secrets/google |
| - name: gcloud-config |
| mountPath: /var/config/gcloud |
| env: |
| - name: GOOGLE_APPLICATION_CREDENTIALS |
| value: /var/secrets/google/key.json |
| - name: CLOUDSDK_CONFIG |
| value: /var/config/gcloud |
| volumes: |
| - name: firestore-export-sa |
| secret: |
| secretName: firestore-export |
| - name: gcloud-config |
| emptyDir: {} |