Skip to content

Commit

Permalink
add tolerations to pump/drainer
Browse files Browse the repository at this point in the history
  • Loading branch information
weekface committed Aug 8, 2019
1 parent 45e64cb commit 6e185f5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charts/tidb-cluster/templates/drainer-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ spec:
{{- if .Values.binlog.drainer.affinity }}
affinity:
{{ toYaml .Values.binlog.drainer.affinity | indent 8 }}
{{- end }}
{{- if .Values.binlog.drainer.tolerations }}
tolerations:
{{ toYaml .Values.binlog.drainer.tolerations | indent 8 }}
{{- end }}
containers:
- name: drainer
Expand Down
4 changes: 4 additions & 0 deletions charts/tidb-cluster/templates/pump-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ spec:
{{- if .Values.binlog.pump.affinity }}
affinity:
{{ toYaml .Values.binlog.pump.affinity | indent 8 }}
{{- end }}
{{- if .Values.binlog.pump.tolerations }}
tolerations:
{{ toYaml .Values.binlog.pump.tolerations | indent 8 }}
{{- end }}
containers:
- name: pump
Expand Down
6 changes: 6 additions & 0 deletions charts/tidb-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ binlog:
# affinity for pump pod assignment, default: empty
# 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: []
syncLog: true
# a integer value to control expiry date of the binlog data, indicates for how long (in days) the binlog data would be stored.
# must bigger than 0
Expand All @@ -434,6 +437,9 @@ binlog:
# affinity for drainer pod assignment, default: empty
# 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: []
# the number of the concurrency of the downstream for synchronization. The bigger the value,
# the better throughput performance of the concurrency (16 by default)
workerCount: 16
Expand Down
6 changes: 6 additions & 0 deletions tests/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2356,6 +2356,9 @@ func (oa *operatorActions) CheckIncrementalBackup(info *TidbClusterConfig, withD
if len(pod.Spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution) != 1 {
return true, fmt.Errorf("pump pod %s/%s should have affinity set", pod.Namespace, pod.Name)
}
if len(pod.Spec.Tolerations) != 1 {
return true, fmt.Errorf("pump pod %s/%s should have tolerations set", pod.Namespace, pod.Name)
}
}

if !withDrainer {
Expand Down Expand Up @@ -2396,6 +2399,9 @@ func (oa *operatorActions) CheckIncrementalBackup(info *TidbClusterConfig, withD
if len(pod.Spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution) != 1 {
return true, fmt.Errorf("drainer pod %s/%s should have spec.affinity set", pod.Namespace, pod.Name)
}
if len(pod.Spec.Tolerations) != 1 {
return true, fmt.Errorf("drainer pod %s/%s should have tolerations set", pod.Namespace, pod.Name)
}
}

return true, nil
Expand Down
10 changes: 10 additions & 0 deletions tests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ var affinityTemp string = `{{.Kind}}:
- {{.Namespace}}
binlog:
pump:
tolerations:
- key: node-role
operator: Equal
value: tidb
effect: "NoSchedule"
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -115,6 +120,11 @@ binlog:
namespaces:
- {{.Namespace}}
drainer:
tolerations:
- key: node-role
operator: Equal
value: tidb
effect: "NoSchedule"
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down

0 comments on commit 6e185f5

Please sign in to comment.