Skip to content

Commit

Permalink
Allow to configure Affinity or Tolerations for Backups and Restores (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
Smana and Yisaer authored Feb 24, 2020
1 parent f80c8c2 commit 271cad3
Show file tree
Hide file tree
Showing 11 changed files with 2,283 additions and 259 deletions.
8 changes: 8 additions & 0 deletions charts/tidb-backup/templates/backup-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ spec:
name: {{ .Values.secretName }}
key: password
restartPolicy: OnFailure
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
volumes:
- name: data
persistentVolumeClaim:
Expand Down
8 changes: 8 additions & 0 deletions charts/tidb-backup/templates/restore-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ spec:
secretKeyRef:
name: {{ .Values.secretName }}
key: password
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
volumes:
- name: data
persistentVolumeClaim:
Expand Down
9 changes: 9 additions & 0 deletions charts/tidb-backup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ extraLabels: {}
# Add annotations for backup/restore job's pod
annotations: {}

## affinity defines pd scheduling rules,it's default settings is empty.
## please read the affinity document before set your scheduling rule:
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
affinity: {}

## Tolerations are applied to pods, and allow pods to schedule onto nodes with matching taints.
## refer to https://kubernetes.io/docs/concepts/configuration/taint-and-toleration
tolerations: []

# secretName is the name of the secret which stores user and password used for backup/restore
# Note: you must give the user enough privilege to do the backup and restore
# you can create the secret by:
Expand Down
8 changes: 8 additions & 0 deletions charts/tidb-cluster/templates/scheduled-backup-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ spec:
name: {{ .Values.scheduledBackup.secretName }}
key: password
restartPolicy: {{ .Values.scheduledBackup.restartPolicy | default "OnFailure" }}
{{- if .Values.scheduledBackup.affinity }}
affinity:
{{ toYaml .Values.scheduledBackup.affinity | indent 12 }}
{{- end }}
{{- if .Values.scheduledBackup.tolerations }}
tolerations:
{{ toYaml .Values.scheduledBackup.tolerations | indent 12 }}
{{- end }}
volumes:
- name: data
persistentVolumeClaim:
Expand Down
9 changes: 9 additions & 0 deletions charts/tidb-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,15 @@ scheduledBackup:
# cpu: 4000m
# memory: 4Gi

## affinity defines pd scheduling rules,it's default settings is empty.
## please read the affinity document before set your scheduling rule:
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
affinity: {}

## Tolerations are applied to pods, and allow pods to schedule onto nodes with matching taints.
## refer to https://kubernetes.io/docs/concepts/configuration/taint-and-toleration
tolerations: []

importer:
create: false
image: pingcap/tidb-lightning:v3.0.8
Expand Down
Loading

0 comments on commit 271cad3

Please sign in to comment.