mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 17:38:50 +00:00
Make parallelism as part of schedulerOptions
This commit is contained in:
@@ -98,6 +98,7 @@ type schedulerOptions struct {
|
||||
profiles []schedulerapi.KubeSchedulerProfile
|
||||
extenders []schedulerapi.Extender
|
||||
frameworkCapturer FrameworkCapturer
|
||||
parallelism int32
|
||||
}
|
||||
|
||||
// Option configures a Scheduler
|
||||
@@ -112,10 +113,9 @@ func WithProfiles(p ...schedulerapi.KubeSchedulerProfile) Option {
|
||||
}
|
||||
|
||||
// WithParallelism sets the parallelism for all scheduler algorithms. Default is 16.
|
||||
// TODO(#95952): Remove global setter in favor of a struct that holds the configuration.
|
||||
func WithParallelism(threads int32) Option {
|
||||
return func(o *schedulerOptions) {
|
||||
parallelize.SetParallelism(int(threads))
|
||||
o.parallelism = threads
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ var defaultSchedulerOptions = schedulerOptions{
|
||||
percentageOfNodesToScore: schedulerapi.DefaultPercentageOfNodesToScore,
|
||||
podInitialBackoffSeconds: int64(internalqueue.DefaultPodInitialBackoffDuration.Seconds()),
|
||||
podMaxBackoffSeconds: int64(internalqueue.DefaultPodMaxBackoffDuration.Seconds()),
|
||||
parallelism: int32(parallelize.DefaultParallelism),
|
||||
}
|
||||
|
||||
// New returns a Scheduler
|
||||
@@ -225,6 +226,7 @@ func New(client clientset.Interface,
|
||||
nodeInfoSnapshot: snapshot,
|
||||
extenders: options.extenders,
|
||||
frameworkCapturer: options.frameworkCapturer,
|
||||
parallellism: options.parallelism,
|
||||
}
|
||||
|
||||
metrics.Register()
|
||||
|
Reference in New Issue
Block a user