Skip to content

Commit 0714abb

Browse files
authored
Merge pull request #6446 from XiShanYongYe-Chang/fix-6438
Fix the issue of unjoin cluster failed when disable Failover and taint-manager
2 parents bd5692f + c92b0d8 commit 0714abb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

cmd/controller-manager/app/controllermanager.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ func startClusterController(ctx controllerscontext.Context) (enabled bool, err e
258258
mgr := ctx.Mgr
259259
opts := ctx.Opts
260260

261+
// Indexes are added to help the cluster-controller and TaintManager quickly locate ResourceBinding
262+
// and ClusterResourceBinding resources associated with a given cluster when eviction is needed.
263+
if err := indexregistry.RegisterResourceBindingIndexByFieldCluster(ctx.Context, mgr); err != nil {
264+
return false, err
265+
}
266+
if err := indexregistry.RegisterClusterResourceBindingIndexByFieldCluster(ctx.Context, mgr); err != nil {
267+
return false, err
268+
}
269+
261270
clusterController := &cluster.Controller{
262271
Client: mgr.GetClient(),
263272
EventRecorder: mgr.GetEventRecorderFor(cluster.ControllerName),
@@ -273,14 +282,6 @@ func startClusterController(ctx controllerscontext.Context) (enabled bool, err e
273282

274283
// Taint-based eviction should only take effect if the Failover feature is enabled
275284
if ctx.Opts.EnableTaintManager && features.FeatureGate.Enabled(features.Failover) {
276-
// Indexes are added to help the TaintManager quickly locate ResourceBinding and ClusterResourceBinding resources
277-
// associated with a given cluster when eviction is needed.
278-
if err := indexregistry.RegisterResourceBindingIndexByFieldCluster(ctx.Context, mgr); err != nil {
279-
return false, err
280-
}
281-
if err := indexregistry.RegisterClusterResourceBindingIndexByFieldCluster(ctx.Context, mgr); err != nil {
282-
return false, err
283-
}
284285
taintManager := &cluster.NoExecuteTaintManager{
285286
Client: mgr.GetClient(),
286287
EventRecorder: mgr.GetEventRecorderFor(cluster.TaintManagerName),

0 commit comments

Comments
 (0)