Browse Source

Add real velero backup support

master
Fábio Kaiser Rauber 3 years ago
parent
commit
7a10655fe5
  1. 10
      charts/portalmodelo/v0.5.0/questions.yaml
  2. 6
      charts/portalmodelo/v0.5.0/templates/repozo-configmap.yaml
  3. 19
      charts/portalmodelo/v0.5.0/templates/velero-schedule-monthly.yaml
  4. 19
      charts/portalmodelo/v0.5.0/templates/velero-schedule-weekdays.yaml
  5. 19
      charts/portalmodelo/v0.5.0/templates/velero-schedule-weekly.yaml
  6. 10
      charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml
  7. 2
      charts/portalmodelo/v0.5.0/values.yaml

10
charts/portalmodelo/v0.5.0/questions.yaml

@ -125,14 +125,14 @@ questions:
description: "Espaço em disco disponível para o portal."
group: Armazenamento
- variable: velero.backup.enabled
default: false
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
- variable: repozo.enabled
default: true
default: false
type: boolean
label: "Habilitar backup com Repozo?"
description: "Habilitar ou não backup com repozo em volumes NFS."
@ -158,6 +158,12 @@ questions:
label: "Número de dias de backups de blobs a guardar."
description: "Recomendado utilizar a fórmula 'keep * days_between_zeopack = keep_blob_days'."
required: false
- variable: repozo.backupblobs
default: false
type: boolean
label: "Backup Blobs"
description: "Fazer ou não o backup dos blobs com o repozo."
required: false
# Configurações Avançadas
- variable: portal.timeZone

6
charts/portalmodelo/v0.5.0/templates/repozo-configmap.yaml

@ -1,4 +1,4 @@
{{- if and .Values.persistence.enabled .Values.repozo.enabled }}
{{- if and .Values.persistence.enabled (or .Values.repozo.enabled .Values.velero.backup.enabled )}}
apiVersion: v1
kind: ConfigMap
metadata:
@ -51,7 +51,11 @@ data:
verbose=False,
gzip=True,
only_blobs=False,
{{- if .Values.repozo.backupblobs }}
backup_blobs=True,
{{- else }}
backup_blobs=False,
{{- end }}
use_rsync=True,
gzip_blob=False,
pre_command='',

19
charts/portalmodelo/v0.5.0/templates/velero-schedule-monthly.yaml

@ -17,5 +17,24 @@ spec:
snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }}
# every weekday backup is good for the next year (365 days)
ttl: 8760h0m0s
defaultVolumesToRestic: {{ .Values.velero.backup.defaultVolumesToRestic }}
hooks:
resources:
- name: repozo
includedResources:
- pods
labelSelector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: portalmodelo
app.kubernetes.io/component: zeoserver
pre:
- exec:
command:
- "/bin/bash"
- "-c"
- "/plone/Python-2.7/bin/python /plone/instance/bin/backup"
timeout: 3600s
onError: Continue
useOwnerReferencesInBackup: false
{{- end }}

19
charts/portalmodelo/v0.5.0/templates/velero-schedule-weekdays.yaml

@ -17,5 +17,24 @@ spec:
snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }}
# every weekday backup is good for the next week (7 days)
ttl: 168h0m0s
defaultVolumesToRestic: {{ .Values.velero.backup.defaultVolumesToRestic }}
hooks:
resources:
- name: repozo
includedResources:
- pods
labelSelector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: portalmodelo
app.kubernetes.io/component: zeoserver
pre:
- exec:
command:
- "/bin/bash"
- "-c"
- "/plone/Python-2.7/bin/python /plone/instance/bin/backup"
timeout: 3600s
onError: Continue
useOwnerReferencesInBackup: false
{{- end }}

19
charts/portalmodelo/v0.5.0/templates/velero-schedule-weekly.yaml

@ -17,5 +17,24 @@ spec:
snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }}
# every sunday backup is good for 30 days (aprox. 1 month)
ttl: 744h0m0s
defaultVolumesToRestic: {{ .Values.velero.backup.defaultVolumesToRestic }}
hooks:
resources:
- name: repozo
includedResources:
- pods
labelSelector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: portalmodelo
app.kubernetes.io/component: zeoserver
pre:
- exec:
command:
- "/bin/bash"
- "-c"
- "/plone/Python-2.7/bin/python /plone/instance/bin/backup"
timeout: 3600s
onError: Continue
useOwnerReferencesInBackup: false
{{- end }}

10
charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml

@ -79,6 +79,11 @@ spec:
volumeMounts:
- mountPath: /data
name: data
{{- if .Values.velero.backup.enabled }}
- mountPath: /plone/instance/bin/backup
subPath: backup
name: backupscript
{{- end }}
livenessProbe:
tcpSocket:
port: 8100
@ -106,6 +111,11 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.velero.backup.enabled }}
- name: backupscript
configMap:
name: {{ include "portalmodelo.fullname" . }}-backupscript
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}

2
charts/portalmodelo/v0.5.0/values.yaml

@ -25,6 +25,7 @@ velero:
backup:
enabled: false
snapshotVolumes: true
defaultVolumesToRestic: true
# cert-manager objects are usually blocked during backup
excludedResources:
- certificates.cert-manager.io
@ -58,6 +59,7 @@ repozo:
storageClass: nfs-backup
keep: 1
keepblobdays: 30
backupblobs: true
podAnnotations: {}

Loading…
Cancel
Save