[backups] Added staggered backups

This PS adds staggered backups possibility by adding anti-affinity rules
to backups cronjobs that can be followed across several namespaces to
decrease load on remote backup destination server making sure that at
every moment in time there is only one backup upload is in progress.

Change-Id: I320c6ce6370b45c602114189819a4225e479f680
This commit is contained in:
Sergiy Markin 2023-12-01 22:45:54 +00:00
parent 903b1363db
commit 7cac24f640
3 changed files with 24 additions and 1 deletions

View File

@ -15,4 +15,4 @@
apiVersion: v1
description: A chart for a DaemonSet-based etcd deployment.
name: etcd
version: 0.1.2
version: 0.1.3

View File

@ -75,6 +75,7 @@ spec:
metadata:
labels:
{{ tuple $envAll $applicationName "etcd-anchor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
{{ index $envAll.Values.backup "labels" | toYaml | indent 8}}
annotations:
{{ dict "envAll" $envAll "podName" "etcd-backup" "containerNames" (list "etcd-backup") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
spec:
@ -83,6 +84,10 @@ spec:
{{ dict "envAll" $envAll "application" "etcd-backup" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 10 }}
serviceAccountName: {{ .Values.service.name }}-{{ $serviceAccountName }}
restartPolicy: OnFailure
{{- if $envAll.Values.backup.affinity }}
affinity:
{{ index $envAll.Values.backup "affinity" | toYaml | indent 12}}
{{- end }}
nodeSelector:
{{ .Values.labels.anchor.node_selector_key }}: {{ .Values.labels.anchor.node_selector_value }}
containers:

View File

@ -62,6 +62,24 @@ etcd:
backup:
enabled: true
host_backup_path: /var/backups
labels:
staggered-backups: enabled
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: status.phase
operator: NotIn
values:
- Running
- key: staggered-backups
operator: In
values:
- enabled
namespaces:
- openstack
topologyKey: kubernetes.io/os
backup_log_file: /var/log/etcd-backup.log
no_backup_keep: 10
etcdctl_dial_timeout: 15s