From 86d6cde826a5dcc1efd77a2bbd36c8b8f7a83051 Mon Sep 17 00:00:00 2001 From: Fabio Date: Thu, 11 May 2023 11:47:16 -0300 Subject: [PATCH] Emailleg backup to use snapshots and FS backup --- .../templates/velero-schedule-monthly.yaml | 22 +++++++++++++++++++ .../templates/velero-schedule-weekdays.yaml | 22 +++++++++++++++++++ .../templates/velero-schedule-weekly.yaml | 12 +++++----- charts/emailleg/v1.4.0/values.yaml | 2 -- 4 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 charts/emailleg/v1.4.0/templates/velero-schedule-monthly.yaml create mode 100644 charts/emailleg/v1.4.0/templates/velero-schedule-weekdays.yaml diff --git a/charts/emailleg/v1.4.0/templates/velero-schedule-monthly.yaml b/charts/emailleg/v1.4.0/templates/velero-schedule-monthly.yaml new file mode 100644 index 0000000..44516b3 --- /dev/null +++ b/charts/emailleg/v1.4.0/templates/velero-schedule-monthly.yaml @@ -0,0 +1,22 @@ +{{- if .Values.velero.backup.enabled }} +apiVersion: velero.io/v1 +kind: Schedule +metadata: + name: {{ include "emailleg.fullname" . }}-monthly + namespace: {{ .Values.velero.namespace }} +spec: + # generate a random backup time between 1 and 5 AM on first day of every month + schedule: {{ mod (randNumeric 2) 60 }} {{ mod (randNumeric 1) 6 }} 1 * * + template: + includedNamespaces: + - {{ .Release.Namespace }} + {{- with .Values.velero.backup.excludedResources }} + excludedResources: + {{- toYaml . | nindent 8 }} + {{- end }} + snapshotVolumes: false + # every monthly backup is good for 6 months (~180 days) + ttl: 4380h0m0s + defaultVolumesToFsBackup: true + useOwnerReferencesInBackup: false +{{- end }} \ No newline at end of file diff --git a/charts/emailleg/v1.4.0/templates/velero-schedule-weekdays.yaml b/charts/emailleg/v1.4.0/templates/velero-schedule-weekdays.yaml new file mode 100644 index 0000000..ef27366 --- /dev/null +++ b/charts/emailleg/v1.4.0/templates/velero-schedule-weekdays.yaml @@ -0,0 +1,22 @@ +{{- if .Values.velero.backup.enabled }} +apiVersion: velero.io/v1 +kind: Schedule +metadata: + name: {{ include "emailleg.fullname" . }}-weekdays + namespace: {{ .Values.velero.namespace }} +spec: + # generate a random backup time between 1 and 5 AM on weekdays + schedule: {{ mod (randNumeric 2) 60 }} {{ mod (randNumeric 1) 6 }} * * 1-5 + template: + includedNamespaces: + - {{ .Release.Namespace }} + {{- with .Values.velero.backup.excludedResources }} + excludedResources: + {{- toYaml . | nindent 8 }} + {{- end }} + snapshotVolumes: true + # every backup is good for 7 days (one week) + ttl: 168h0m0s + defaultVolumesToFsBackup: false + useOwnerReferencesInBackup: false +{{- end }} \ No newline at end of file diff --git a/charts/emailleg/v1.4.0/templates/velero-schedule-weekly.yaml b/charts/emailleg/v1.4.0/templates/velero-schedule-weekly.yaml index 17536f6..cb260f9 100644 --- a/charts/emailleg/v1.4.0/templates/velero-schedule-weekly.yaml +++ b/charts/emailleg/v1.4.0/templates/velero-schedule-weekly.yaml @@ -5,8 +5,8 @@ metadata: name: {{ include "emailleg.fullname" . }}-weekly namespace: {{ .Values.velero.namespace }} spec: - # generate a random backup time between 1 and 5 AM on Monday, Wednesday and Friday - schedule: {{ mod (randNumeric 2) 60 }} {{ mod (randNumeric 1) 6 }} * * MON,WED,FRI + # generate a random backup time between 1 and 5 AM on sunday + schedule: {{ mod (randNumeric 2) 60 }} {{ mod (randNumeric 1) 6 }} * * 0 template: includedNamespaces: - {{ .Release.Namespace }} @@ -14,9 +14,9 @@ spec: excludedResources: {{- toYaml . | nindent 8 }} {{- end }} - snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }} - # every backup is good for 7 days (one week) - ttl: 168h0m0s - defaultVolumesToRestic: {{ .Values.velero.backup.defaultVolumesToRestic }} + snapshotVolumes: false + # every sunday backup is good for 30 days (aprox. 1 month) + ttl: 744h0m0s + defaultVolumesToFsBackup: true useOwnerReferencesInBackup: false {{- end }} \ No newline at end of file diff --git a/charts/emailleg/v1.4.0/values.yaml b/charts/emailleg/v1.4.0/values.yaml index 2fa9ffb..b6b366d 100755 --- a/charts/emailleg/v1.4.0/values.yaml +++ b/charts/emailleg/v1.4.0/values.yaml @@ -108,8 +108,6 @@ velero: namespace: velero backup: enabled: true - snapshotVolumes: false - defaultVolumesToRestic: true # cert-manager objects are usually blocked during backup excludedResources: - certificates.cert-manager.io