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." description: "Espaço em disco disponível para o portal."
group: Armazenamento group: Armazenamento
- variable: velero.backup.enabled - variable: velero.backup.enabled
default: false default: true
type: boolean type: boolean
label: "Habilitar backup com Velero?" label: "Habilitar backup com Velero?"
description: "Criar ou não os objetos para backup com o Velero." description: "Criar ou não os objetos para backup com o Velero."
required: false required: false
group: Armazenamento group: Armazenamento
- variable: repozo.enabled - variable: repozo.enabled
default: true default: false
type: boolean type: boolean
label: "Habilitar backup com Repozo?" label: "Habilitar backup com Repozo?"
description: "Habilitar ou não backup com repozo em volumes NFS." 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." label: "Número de dias de backups de blobs a guardar."
description: "Recomendado utilizar a fórmula 'keep * days_between_zeopack = keep_blob_days'." description: "Recomendado utilizar a fórmula 'keep * days_between_zeopack = keep_blob_days'."
required: false 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 # Configurações Avançadas
- variable: portal.timeZone - 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 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
@ -51,7 +51,11 @@ data:
verbose=False, verbose=False,
gzip=True, gzip=True,
only_blobs=False, only_blobs=False,
{{- if .Values.repozo.backupblobs }}
backup_blobs=True, backup_blobs=True,
{{- else }}
backup_blobs=False,
{{- end }}
use_rsync=True, use_rsync=True,
gzip_blob=False, gzip_blob=False,
pre_command='', pre_command='',

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

@ -17,5 +17,24 @@ spec:
snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }} snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }}
# every weekday backup is good for the next year (365 days) # every weekday backup is good for the next year (365 days)
ttl: 8760h0m0s 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 useOwnerReferencesInBackup: false
{{- end }} {{- end }}

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

@ -17,5 +17,24 @@ spec:
snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }} snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }}
# every weekday backup is good for the next week (7 days) # every weekday backup is good for the next week (7 days)
ttl: 168h0m0s 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 useOwnerReferencesInBackup: false
{{- end }} {{- end }}

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

@ -17,5 +17,24 @@ spec:
snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }} snapshotVolumes: {{ .Values.velero.backup.snapshotVolumes }}
# every sunday backup is good for 30 days (aprox. 1 month) # every sunday backup is good for 30 days (aprox. 1 month)
ttl: 744h0m0s 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 useOwnerReferencesInBackup: false
{{- end }} {{- end }}

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

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

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

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

Loading…
Cancel
Save