Skip to content

Commit

Permalink
1908 (#2007)
Browse files Browse the repository at this point in the history
* fixes issue #1908

Co-authored-by: Jiazhen Xu <[email protected]>
  • Loading branch information
MundaneImmortal and Jiazhen Xu authored Apr 10, 2024
1 parent 682fd01 commit 839a52a
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 839a52a

Please sign in to comment.