Skip to content

Commit 93de38c

Browse files
authored
fix(tidb): do not sync server labels for standby tidb (#6508)
1 parent bf59b48 commit 93de38c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pkg/controllers/tidb/builder.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package tidb
1717
import (
1818
"context"
1919

20+
"github.com/pingcap/tidb-operator/api/v2/core/v1alpha1"
2021
"github.com/pingcap/tidb-operator/pkg/controllers/common"
2122
"github.com/pingcap/tidb-operator/pkg/controllers/tidb/tasks"
2223
"github.com/pingcap/tidb-operator/pkg/runtime/scope"
@@ -67,6 +68,10 @@ func (r *Reconciler) NewRunner(state *tasks.ReconcileContext, reporter task.Task
6768
tasks.TaskPod(state, r.Client),
6869
tasks.TaskActivate(state, r.Client),
6970
common.TaskServerLabels[scope.TiDB](state, r.Client, func(ctx context.Context, labels map[string]string) error {
71+
// standby tidb cannot set server labels
72+
if state.Object().Spec.Mode == v1alpha1.TiDBModeStandBy {
73+
return nil
74+
}
7075
return state.TiDBClient.SetServerLabels(ctx, labels)
7176
}),
7277
common.TaskInstanceConditionSynced[scope.TiDB](state),

0 commit comments

Comments
 (0)