Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* fixes issue openyurtio#1908

Co-authored-by: Jiazhen Xu <[email protected]>
  • Loading branch information
2 people authored and zyjhtangtang committed Apr 16, 2024
1 parent fb71a31 commit 7fc8432
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion cmd/yurt-manager/app/options/nodepoolcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewNodePoolControllerOptions() *NodePoolControllerOptions {
return &NodePoolControllerOptions{
&config.NodePoolControllerConfiguration{
EnableSyncNodePoolConfigurations: true,
ConcurrentNodepools: 3,
},
}
}
Expand All @@ -40,7 +41,7 @@ func (n *NodePoolControllerOptions) AddFlags(fs *pflag.FlagSet) {
return
}

fs.BoolVar(&n.EnableSyncNodePoolConfigurations, "enable-sync-nodepool-configurations", n.EnableSyncNodePoolConfigurations, "enable to sync nodepool configurations(including labels, annotations, taints in spec) to nodes in the nodepool.")
fs.Int32Var(&n.ConcurrentNodepools, "concurrent-nodepools", n.ConcurrentNodepools, "The number of node pools that are allowed to reconcile concurrently.")
}

// ApplyTo fills up nodePool config with options.
Expand All @@ -49,6 +50,7 @@ func (o *NodePoolControllerOptions) ApplyTo(cfg *config.NodePoolControllerConfig
return nil
}
cfg.EnableSyncNodePoolConfigurations = o.EnableSyncNodePoolConfigurations
cfg.ConcurrentNodepools = o.ConcurrentNodepools

return nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/yurtmanager/controller/nodepool/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ package config
// NodePoolControllerConfiguration contains elements describing NodePoolController.
type NodePoolControllerConfiguration struct {
EnableSyncNodePoolConfigurations bool
ConcurrentNodepools int32
}
5 changes: 2 additions & 3 deletions pkg/yurtmanager/controller/nodepool/nodepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ import (
)

var (
concurrentReconciles = 3
controllerResource = appsv1beta1.SchemeGroupVersion.WithResource("nodepools")
controllerResource = appsv1beta1.SchemeGroupVersion.WithResource("nodepools")
)

func Format(format string, args ...interface{}) string {
Expand Down Expand Up @@ -80,7 +79,7 @@ func Add(ctx context.Context, c *config.CompletedConfig, mgr manager.Manager) er

// Create a new controller
ctrl, err := controller.New(names.NodePoolController, mgr, controller.Options{
Reconciler: r, MaxConcurrentReconciles: concurrentReconciles,
Reconciler: r, MaxConcurrentReconciles: int(c.ComponentConfig.NodePoolController.ConcurrentNodepools),
})
if err != nil {
return err
Expand Down

0 comments on commit 7fc8432

Please sign in to comment.