Skip to content

Commit 271cad3

Browse files
SmanaYisaer
andauthored
Allow to configure Affinity or Tolerations for Backups and Restores (#1737)
* Allow to configure Affinity or Tolerations for Backups and Restores * Add affinity and tolerations options to Helm charts for backup and restore * Update CRD's, affinity and tolerations for backup and restore Co-authored-by: Song Gao <disxiaofei@163.com>
1 parent f80c8c2 commit 271cad3

File tree

11 files changed

+2283
-259
lines changed

11 files changed

+2283
-259
lines changed

charts/tidb-backup/templates/backup-job.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ spec:
9090
name: {{ .Values.secretName }}
9191
key: password
9292
restartPolicy: OnFailure
93+
{{- if .Values.affinity }}
94+
affinity:
95+
{{ toYaml .Values.affinity | indent 8 }}
96+
{{- end }}
97+
{{- if .Values.tolerations }}
98+
tolerations:
99+
{{ toYaml .Values.tolerations | indent 8 }}
100+
{{- end }}
93101
volumes:
94102
- name: data
95103
persistentVolumeClaim:

charts/tidb-backup/templates/restore-job.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ spec:
8181
secretKeyRef:
8282
name: {{ .Values.secretName }}
8383
key: password
84+
{{- if .Values.affinity }}
85+
affinity:
86+
{{ toYaml .Values.affinity | indent 8 }}
87+
{{- end }}
88+
{{- if .Values.tolerations }}
89+
tolerations:
90+
{{ toYaml .Values.tolerations | indent 8 }}
91+
{{- end }}
8492
volumes:
8593
- name: data
8694
persistentVolumeClaim:

charts/tidb-backup/values.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ extraLabels: {}
4040
# Add annotations for backup/restore job's pod
4141
annotations: {}
4242

43+
## affinity defines pd scheduling rules,it's default settings is empty.
44+
## please read the affinity document before set your scheduling rule:
45+
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
46+
affinity: {}
47+
48+
## Tolerations are applied to pods, and allow pods to schedule onto nodes with matching taints.
49+
## refer to https://kubernetes.io/docs/concepts/configuration/taint-and-toleration
50+
tolerations: []
51+
4352
# secretName is the name of the secret which stores user and password used for backup/restore
4453
# Note: you must give the user enough privilege to do the backup and restore
4554
# you can create the secret by:

charts/tidb-cluster/templates/scheduled-backup-cronjob.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ spec:
9797
name: {{ .Values.scheduledBackup.secretName }}
9898
key: password
9999
restartPolicy: {{ .Values.scheduledBackup.restartPolicy | default "OnFailure" }}
100+
{{- if .Values.scheduledBackup.affinity }}
101+
affinity:
102+
{{ toYaml .Values.scheduledBackup.affinity | indent 12 }}
103+
{{- end }}
104+
{{- if .Values.scheduledBackup.tolerations }}
105+
tolerations:
106+
{{ toYaml .Values.scheduledBackup.tolerations | indent 12 }}
107+
{{- end }}
100108
volumes:
101109
- name: data
102110
persistentVolumeClaim:

charts/tidb-cluster/values.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,15 @@ scheduledBackup:
773773
# cpu: 4000m
774774
# memory: 4Gi
775775

776+
## affinity defines pd scheduling rules,it's default settings is empty.
777+
## please read the affinity document before set your scheduling rule:
778+
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
779+
affinity: {}
780+
781+
## Tolerations are applied to pods, and allow pods to schedule onto nodes with matching taints.
782+
## refer to https://kubernetes.io/docs/concepts/configuration/taint-and-toleration
783+
tolerations: []
784+
776785
importer:
777786
create: false
778787
image: pingcap/tidb-lightning:v3.0.8

0 commit comments

Comments
 (0)