mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
Merge pull request #117197 from pohly/scheduler-perf-cleanup
scheduler perf: remove cleanup func
This commit is contained in:
commit
2bfaaf21c1
@ -750,8 +750,7 @@ func runWorkload(ctx context.Context, b *testing.B, tc *testCase, w *workload) [
|
||||
b.Fatalf("validate scheduler config file failed: %v", err)
|
||||
}
|
||||
}
|
||||
finalFunc, podInformer, client, dynClient := mustSetupScheduler(ctx, b, cfg)
|
||||
b.Cleanup(finalFunc)
|
||||
podInformer, client, dynClient := mustSetupScheduler(ctx, b, cfg)
|
||||
|
||||
var mu sync.Mutex
|
||||
var dataItems []DataItem
|
||||
|
@ -75,8 +75,7 @@ func newDefaultComponentConfig() (*config.KubeSchedulerConfiguration, error) {
|
||||
// remove resources after finished.
|
||||
// Notes on rate limiter:
|
||||
// - client rate limit is set to 5000.
|
||||
func mustSetupScheduler(ctx context.Context, b *testing.B, config *config.KubeSchedulerConfiguration) (util.ShutdownFunc, coreinformers.PodInformer, clientset.Interface, dynamic.Interface) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
func mustSetupScheduler(ctx context.Context, b *testing.B, config *config.KubeSchedulerConfiguration) (coreinformers.PodInformer, clientset.Interface, dynamic.Interface) {
|
||||
// Run API server with minimimal logging by default. Can be raised with -v.
|
||||
framework.MinVerbosity = 0
|
||||
|
||||
@ -86,6 +85,12 @@ func mustSetupScheduler(ctx context.Context, b *testing.B, config *config.KubeSc
|
||||
opts.Admission.GenericAdmission.DisablePlugins = []string{"ServiceAccount", "TaintNodesByCondition", "Priority"}
|
||||
},
|
||||
})
|
||||
b.Cleanup(tearDownFn)
|
||||
|
||||
// Cleanup will be in reverse order: first the clients get cancelled,
|
||||
// then the apiserver is torn down.
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
b.Cleanup(cancel)
|
||||
|
||||
// TODO: client connection configuration, such as QPS or Burst is configurable in theory, this could be derived from the `config`, need to
|
||||
// support this when there is any testcase that depends on such configuration.
|
||||
@ -110,12 +115,7 @@ func mustSetupScheduler(ctx context.Context, b *testing.B, config *config.KubeSc
|
||||
_, podInformer := util.StartScheduler(ctx, client, cfg, config)
|
||||
util.StartFakePVController(ctx, client)
|
||||
|
||||
shutdownFn := func() {
|
||||
cancel()
|
||||
tearDownFn()
|
||||
}
|
||||
|
||||
return shutdownFn, podInformer, client, dynClient
|
||||
return podInformer, client, dynClient
|
||||
}
|
||||
|
||||
// Returns the list of scheduled pods in the specified namespaces.
|
||||
|
Loading…
Reference in New Issue
Block a user