From c535109a30839c9f2e452ff18a17adc15e21369a Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Mon, 28 Jun 2021 16:00:45 -0300 Subject: [PATCH] First attempt to backup using velero --- charts/portalmodelo/v0.5.0/questions.yaml | 7 +++++++ .../templates/velero-schedule-weekdays.yaml | 21 +++++++++++++++++++ charts/portalmodelo/v0.5.0/values.yaml | 4 ++++ 3 files changed, 32 insertions(+) create mode 100644 charts/portalmodelo/v0.5.0/templates/velero-schedule-weekdays.yaml diff --git a/charts/portalmodelo/v0.5.0/questions.yaml b/charts/portalmodelo/v0.5.0/questions.yaml index 0a89f6a..f69fbdc 100644 --- a/charts/portalmodelo/v0.5.0/questions.yaml +++ b/charts/portalmodelo/v0.5.0/questions.yaml @@ -109,6 +109,13 @@ questions: label: "Tamanho do volume" description: "Espaço em disco disponível para o portal." group: Armazenamento +- variable: velero.backup.enabled + default: true + type: boolean + label: "Habilitar backup com Velero?" + description: "Criar ou não os objetos para backup com o Velero." + required: false + group: Armazenamento # Configurações Avançadas - variable: portal.timeZone diff --git a/charts/portalmodelo/v0.5.0/templates/velero-schedule-weekdays.yaml b/charts/portalmodelo/v0.5.0/templates/velero-schedule-weekdays.yaml new file mode 100644 index 0000000..a5ad696 --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/velero-schedule-weekdays.yaml @@ -0,0 +1,21 @@ +{{- if .Values.velero.backup.enabled }} +apiVersion: velero.io/v1 +kind: Schedule +metadata: + name: {{ include "portalmodelo.fullname" . }}-weekdays +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 }} + # cert-manager objects are usually blocked during backup + excludedResources: + - certificates.cert-manager.io + - orders.acme.cert-manager.io + - certificaterequests.cert-manager.io + snapshotVolumes: true + # every weekday backup is good for the next week (7 days) + ttl: 168h0m0s + useOwnerReferencesInBackup: false +{{- end }} \ No newline at end of file diff --git a/charts/portalmodelo/v0.5.0/values.yaml b/charts/portalmodelo/v0.5.0/values.yaml index 339bca6..f787c45 100644 --- a/charts/portalmodelo/v0.5.0/values.yaml +++ b/charts/portalmodelo/v0.5.0/values.yaml @@ -20,6 +20,10 @@ persistence: accessMode: ReadWriteOnce size: 2Gi +velero: + backup: + enabled: false + portal: adminPassword: altereme rootPassword: altereme