Clear shutdown of scheduler metrics recorder

This commit is contained in:
Wojciech Tyczyński
2022-05-20 18:02:41 +02:00
parent 32773d61c4
commit 7060953b92
21 changed files with 61 additions and 40 deletions

View File

@@ -227,9 +227,9 @@ func WithCaptureProfile(c CaptureProfile) Option {
}
}
func defaultFrameworkOptions() frameworkOptions {
func defaultFrameworkOptions(stopCh <-chan struct{}) frameworkOptions {
return frameworkOptions{
metricsRecorder: newMetricsRecorder(1000, time.Second),
metricsRecorder: newMetricsRecorder(1000, time.Second, stopCh),
clusterEventMap: make(map[framework.ClusterEvent]sets.String),
parallelizer: parallelize.NewParallelizer(parallelize.DefaultParallelism),
}
@@ -245,8 +245,8 @@ func WithClusterEventMap(m map[framework.ClusterEvent]sets.String) Option {
var _ framework.Framework = &frameworkImpl{}
// NewFramework initializes plugins given the configuration and the registry.
func NewFramework(r Registry, profile *config.KubeSchedulerProfile, opts ...Option) (framework.Framework, error) {
options := defaultFrameworkOptions()
func NewFramework(r Registry, profile *config.KubeSchedulerProfile, stopCh <-chan struct{}, opts ...Option) (framework.Framework, error) {
options := defaultFrameworkOptions(stopCh)
for _, opt := range opts {
opt(&options)
}