diff --git a/chart/templates/backups.yaml b/chart/templates/backups.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d677651153f3e247f05d94187806c213dab258f9 --- /dev/null +++ b/chart/templates/backups.yaml @@ -0,0 +1,54 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + creationTimestamp: null + name: {{ include "chart.fullname" . }}-backup +spec: + jobTemplate: + metadata: + creationTimestamp: null + name: {{ include "chart.fullname" . }}-backup + labels: + {{- include "chart.selectorLabels" . | nindent 6 }} + spec: + template: + metadata: + creationTimestamp: null + labels: + {{- include "chart.selectorLabels" . | nindent 10 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 12 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 12 }} + volumes: + - name: order-data + persistentVolumeClaim: + claimName: order-data + {{- if .Values.application.secretName }} + - name: application-secret + secret: + secretName: {{ .Values.application.secretName }} + defaultMode: 420 + {{- end }} + containers: + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + name: {{ .Chart.Name }}-backup + command: ["/bin/bash"] + args: ["-c", "bin/do_backup"] + securityContext: + {{- toYaml .Values.securityContext | nindent 14 }} + volumeMounts: + - name: order-data + mountPath: /data + {{- if .Values.application.secretName }} + - name: application-secret + readOnly: true + mountPath: /app/config/production.json + subPath: production.json + {{- end }} + restartPolicy: OnFailure + schedule: '*/15 * * * *' \ No newline at end of file diff --git a/pass/bin/do_backup b/pass/bin/do_backup new file mode 100644 index 0000000000000000000000000000000000000000..61f2fef546c049d1226c2ea38ee62bf93f7cdc3b --- /dev/null +++ b/pass/bin/do_backup @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +node backup