From a436155a2efcd37cd5f3a100d703acbbeec59222 Mon Sep 17 00:00:00 2001 From: xhe Date: Fri, 21 Jul 2023 17:24:08 +0800 Subject: [PATCH] add comments Signed-off-by: xhe --- docs/api-references/docs.md | 5 +++++ pkg/apis/pingcap/v1alpha1/types.go | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 9f06f5dc03b..ed6bd8f0469 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -25497,6 +25497,11 @@ github.com/pingcap/tidb-operator/pkg/apis/label.Label +

MatchLabels is used to overwrite generated corev1.TopologySpreadConstraints.NodeSelector.

+

corev1.TopologySpreadConstraint generated in component_spec.go will set a +NodeSelector automatically with some KV. +Historically, it is l[“comp”] = “” for component tiproxy. And we will use +MatchLabels to keep l[“comp”] = “” for old clusters with tiproxy/

diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go index 217332f2c27..0f656575091 100644 --- a/pkg/apis/pingcap/v1alpha1/types.go +++ b/pkg/apis/pingcap/v1alpha1/types.go @@ -3002,7 +3002,13 @@ type TopologySpreadConstraint struct { // WhenUnsatisfiable is default set to DoNotSchedule // LabelSelector is generated by component type // See pkg/apis/pingcap/v1alpha1/tidbcluster_component.go#TopologySpreadConstraints() - TopologyKey string `json:"topologyKey"` + TopologyKey string `json:"topologyKey"` + // MatchLabels is used to overwrite generated corev1.TopologySpreadConstraints.NodeSelector. + // + // corev1.TopologySpreadConstraint generated in component_spec.go will set a + // NodeSelector automatically with some KV. + // Historically, it is l["comp"] = "" for component tiproxy. And we will use + // MatchLabels to keep l["comp"] = "" for old clusters with tiproxy/ MatchLabels label.Label `json:"matchLabels"` }