Skip to content

Commit fe7de96

Browse files
committed
cleanup scheduler's in-tree plugins registry naming
1 parent 24469a3 commit fe7de96

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

pkg/scheduler/factory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ func newConfigFactoryWithFrameworkRegistry(
587587
func newConfigFactory(
588588
client clientset.Interface, hardPodAffinitySymmetricWeight int32, stopCh <-chan struct{}) *Configurator {
589589
return newConfigFactoryWithFrameworkRegistry(client, hardPodAffinitySymmetricWeight, stopCh,
590-
frameworkplugins.NewDefaultRegistry(&frameworkplugins.RegistryArgs{}), frameworkplugins.NewDefaultConfigProducerRegistry())
590+
frameworkplugins.NewInTreeRegistry(&frameworkplugins.RegistryArgs{}), frameworkplugins.NewConfigProducerRegistry())
591591
}
592592

593593
type fakeExtender struct {

pkg/scheduler/framework/plugins/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
22

33
go_library(
44
name = "go_default_library",
5-
srcs = ["default_registry.go"],
5+
srcs = ["registry.go"],
66
importpath = "k8s.io/kubernetes/pkg/scheduler/framework/plugins",
77
visibility = ["//visibility:public"],
88
deps = [
@@ -72,7 +72,7 @@ filegroup(
7272

7373
go_test(
7474
name = "go_default_test",
75-
srcs = ["default_registry_test.go"],
75+
srcs = ["registry_test.go"],
7676
embed = [":go_default_library"],
7777
deps = [
7878
"//pkg/scheduler/apis/config:go_default_library",

pkg/scheduler/framework/plugins/default_registry.go renamed to pkg/scheduler/framework/plugins/registry.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ type RegistryArgs struct {
5252
VolumeBinder *volumebinder.VolumeBinder
5353
}
5454

55-
// NewDefaultRegistry builds the default registry with all the in-tree plugins.
56-
// This is the registry that Kubernetes default scheduler uses. A scheduler that runs out of tree
57-
// plugins can register additional plugins through the WithFrameworkOutOfTreeRegistry option.
58-
func NewDefaultRegistry(args *RegistryArgs) framework.Registry {
55+
// NewInTreeRegistry builds the registry with all the in-tree plugins.
56+
// A scheduler that runs out of tree plugins can register additional plugins
57+
// through the WithFrameworkOutOfTreeRegistry option.
58+
func NewInTreeRegistry(args *RegistryArgs) framework.Registry {
5959
return framework.Registry{
6060
defaultpodtopologyspread.Name: defaultpodtopologyspread.New,
6161
imagelocality.Name: imagelocality.New,
@@ -115,8 +115,8 @@ type ConfigProducerRegistry struct {
115115
PriorityToConfigProducer map[string]ConfigProducer
116116
}
117117

118-
// NewDefaultConfigProducerRegistry creates a new producer registry.
119-
func NewDefaultConfigProducerRegistry() *ConfigProducerRegistry {
118+
// NewConfigProducerRegistry creates a new producer registry.
119+
func NewConfigProducerRegistry() *ConfigProducerRegistry {
120120
registry := &ConfigProducerRegistry{
121121
PredicateToConfigProducer: make(map[string]ConfigProducer),
122122
PriorityToConfigProducer: make(map[string]ConfigProducer),

pkg/scheduler/framework/plugins/default_registry_test.go renamed to pkg/scheduler/framework/plugins/registry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func produceConfig(keys []string, producersMap map[string]ConfigProducer, args C
4141
}
4242

4343
func TestRegisterConfigProducers(t *testing.T) {
44-
registry := NewDefaultConfigProducerRegistry()
44+
registry := NewConfigProducerRegistry()
4545
testPredicateName1 := "testPredicate1"
4646
testFilterName1 := "testFilter1"
4747
registry.RegisterPredicate(testPredicateName1,

pkg/scheduler/scheduler.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ type schedulerOptions struct {
141141
bindTimeoutSeconds int64
142142
podInitialBackoffSeconds int64
143143
podMaxBackoffSeconds int64
144-
// Default registry contains all in-tree plugins
145-
frameworkDefaultRegistry framework.Registry
146-
// This registry contains out of tree plugins to be merged with default registry.
144+
// Contains all in-tree plugins.
145+
frameworkInTreeRegistry framework.Registry
146+
// This registry contains out of tree plugins to be merged with the in-tree registry.
147147
frameworkOutOfTreeRegistry framework.Registry
148148
frameworkConfigProducerRegistry *frameworkplugins.ConfigProducerRegistry
149149
frameworkPlugins *schedulerapi.Plugins
@@ -195,10 +195,10 @@ func WithBindTimeoutSeconds(bindTimeoutSeconds int64) Option {
195195
}
196196
}
197197

198-
// WithFrameworkDefaultRegistry sets the framework's default registry. This is only used in integration tests.
199-
func WithFrameworkDefaultRegistry(registry framework.Registry) Option {
198+
// WithFrameworkInTreeRegistry sets the framework's in-tree registry. This is only used in integration tests.
199+
func WithFrameworkInTreeRegistry(registry framework.Registry) Option {
200200
return func(o *schedulerOptions) {
201-
o.frameworkDefaultRegistry = registry
201+
o.frameworkInTreeRegistry = registry
202202
}
203203
}
204204

@@ -256,7 +256,7 @@ var defaultSchedulerOptions = schedulerOptions{
256256
bindTimeoutSeconds: BindTimeoutSeconds,
257257
podInitialBackoffSeconds: int64(internalqueue.DefaultPodInitialBackoffDuration.Seconds()),
258258
podMaxBackoffSeconds: int64(internalqueue.DefaultPodMaxBackoffDuration.Seconds()),
259-
frameworkConfigProducerRegistry: frameworkplugins.NewDefaultConfigProducerRegistry(),
259+
frameworkConfigProducerRegistry: frameworkplugins.NewConfigProducerRegistry(),
260260
// The plugins and pluginConfig options are currently nil because we currently don't have
261261
// "default" plugins. All plugins that we run through the framework currently come from two
262262
// sources: 1) specified in component config, in which case those two options should be
@@ -297,9 +297,9 @@ func New(client clientset.Interface,
297297
time.Duration(options.bindTimeoutSeconds)*time.Second,
298298
)
299299

300-
registry := options.frameworkDefaultRegistry
300+
registry := options.frameworkInTreeRegistry
301301
if registry == nil {
302-
registry = frameworkplugins.NewDefaultRegistry(&frameworkplugins.RegistryArgs{
302+
registry = frameworkplugins.NewInTreeRegistry(&frameworkplugins.RegistryArgs{
303303
VolumeBinder: volumeBinder,
304304
})
305305
}

pkg/scheduler/scheduler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func TestSchedulerCreation(t *testing.T) {
203203

204204
// Test case for when a plugin name in frameworkOutOfTreeRegistry already exist in defaultRegistry.
205205
fakeFrameworkPluginName := ""
206-
for name := range frameworkplugins.NewDefaultRegistry(&frameworkplugins.RegistryArgs{}) {
206+
for name := range frameworkplugins.NewInTreeRegistry(&frameworkplugins.RegistryArgs{}) {
207207
fakeFrameworkPluginName = name
208208
break
209209
}

test/integration/scheduler/framework_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ func TestPreFilterPlugin(t *testing.T) {
483483
// Create the master and the scheduler with the test plugin set.
484484
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "prefilter-plugin", nil), 2,
485485
scheduler.WithFrameworkPlugins(plugins),
486-
scheduler.WithFrameworkDefaultRegistry(registry))
486+
scheduler.WithFrameworkInTreeRegistry(registry))
487487
defer cleanupTest(t, context)
488488

489489
tests := []struct {
@@ -554,7 +554,7 @@ func TestScorePlugin(t *testing.T) {
554554

555555
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "score-plugin", nil), 10,
556556
scheduler.WithFrameworkPlugins(plugins),
557-
scheduler.WithFrameworkDefaultRegistry(registry))
557+
scheduler.WithFrameworkInTreeRegistry(registry))
558558
defer cleanupTest(t, context)
559559

560560
for i, fail := range []bool{false, true} {
@@ -612,7 +612,7 @@ func TestNormalizeScorePlugin(t *testing.T) {
612612
}
613613
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "score-plugin", nil), 10,
614614
scheduler.WithFrameworkPlugins(plugins),
615-
scheduler.WithFrameworkDefaultRegistry(registry))
615+
scheduler.WithFrameworkInTreeRegistry(registry))
616616

617617
defer cleanupTest(t, context)
618618

@@ -657,7 +657,7 @@ func TestReservePlugin(t *testing.T) {
657657
// Create the master and the scheduler with the test plugin set.
658658
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "reserve-plugin", nil), 2,
659659
scheduler.WithFrameworkPlugins(plugins),
660-
scheduler.WithFrameworkDefaultRegistry(registry))
660+
scheduler.WithFrameworkInTreeRegistry(registry))
661661
defer cleanupTest(t, context)
662662

663663
for _, fail := range []bool{false, true} {
@@ -709,7 +709,7 @@ func TestPrebindPlugin(t *testing.T) {
709709
// Create the master and the scheduler with the test plugin set.
710710
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "prebind-plugin", nil), 2,
711711
scheduler.WithFrameworkPlugins(plugins),
712-
scheduler.WithFrameworkDefaultRegistry(registry))
712+
scheduler.WithFrameworkInTreeRegistry(registry))
713713
defer cleanupTest(t, context)
714714

715715
tests := []struct {
@@ -792,7 +792,7 @@ func TestUnreservePlugin(t *testing.T) {
792792
// Create the master and the scheduler with the test plugin set.
793793
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "unreserve-plugin", nil), 2,
794794
scheduler.WithFrameworkPlugins(plugins),
795-
scheduler.WithFrameworkDefaultRegistry(registry))
795+
scheduler.WithFrameworkInTreeRegistry(registry))
796796
defer cleanupTest(t, context)
797797

798798
tests := []struct {
@@ -882,7 +882,7 @@ func TestBindPlugin(t *testing.T) {
882882
// Create the master and the scheduler with the test plugin set.
883883
context := initTestSchedulerWithOptions(t, testContext, false, nil, time.Second,
884884
scheduler.WithFrameworkPlugins(plugins),
885-
scheduler.WithFrameworkDefaultRegistry(registry),
885+
scheduler.WithFrameworkInTreeRegistry(registry),
886886
scheduler.WithFrameworkConfigProducerRegistry(nil))
887887
defer cleanupTest(t, context)
888888

@@ -1043,7 +1043,7 @@ func TestPostBindPlugin(t *testing.T) {
10431043
// Create the master and the scheduler with the test plugin set.
10441044
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "postbind-plugin", nil), 2,
10451045
scheduler.WithFrameworkPlugins(plugins),
1046-
scheduler.WithFrameworkDefaultRegistry(registry))
1046+
scheduler.WithFrameworkInTreeRegistry(registry))
10471047
defer cleanupTest(t, context)
10481048

10491049
tests := []struct {
@@ -1099,7 +1099,7 @@ func TestPermitPlugin(t *testing.T) {
10991099
// Create the master and the scheduler with the test plugin set.
11001100
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "permit-plugin", nil), 2,
11011101
scheduler.WithFrameworkPlugins(plugins),
1102-
scheduler.WithFrameworkDefaultRegistry(registry))
1102+
scheduler.WithFrameworkInTreeRegistry(registry))
11031103
defer cleanupTest(t, context)
11041104

11051105
tests := []struct {
@@ -1187,7 +1187,7 @@ func TestMultiplePermitPlugins(t *testing.T) {
11871187
// Create the master and the scheduler with the test plugin set.
11881188
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "multi-permit-plugin", nil), 2,
11891189
scheduler.WithFrameworkPlugins(plugins),
1190-
scheduler.WithFrameworkDefaultRegistry(registry))
1190+
scheduler.WithFrameworkInTreeRegistry(registry))
11911191
defer cleanupTest(t, context)
11921192

11931193
// Both permit plugins will return Wait for permitting
@@ -1242,7 +1242,7 @@ func TestPermitPluginsCancelled(t *testing.T) {
12421242
// Create the master and the scheduler with the test plugin set.
12431243
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "permit-plugins", nil), 2,
12441244
scheduler.WithFrameworkPlugins(plugins),
1245-
scheduler.WithFrameworkDefaultRegistry(registry))
1245+
scheduler.WithFrameworkInTreeRegistry(registry))
12461246
defer cleanupTest(t, context)
12471247

12481248
// Both permit plugins will return Wait for permitting
@@ -1283,7 +1283,7 @@ func TestCoSchedulingWithPermitPlugin(t *testing.T) {
12831283
// Create the master and the scheduler with the test plugin set.
12841284
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "permit-plugin", nil), 2,
12851285
scheduler.WithFrameworkPlugins(plugins),
1286-
scheduler.WithFrameworkDefaultRegistry(registry))
1286+
scheduler.WithFrameworkInTreeRegistry(registry))
12871287
defer cleanupTest(t, context)
12881288

12891289
tests := []struct {
@@ -1364,7 +1364,7 @@ func TestFilterPlugin(t *testing.T) {
13641364
// Create the master and the scheduler with the test plugin set.
13651365
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "filter-plugin", nil), 2,
13661366
scheduler.WithFrameworkPlugins(plugins),
1367-
scheduler.WithFrameworkDefaultRegistry(registry))
1367+
scheduler.WithFrameworkInTreeRegistry(registry))
13681368
defer cleanupTest(t, context)
13691369

13701370
for _, fail := range []bool{false, true} {
@@ -1415,7 +1415,7 @@ func TestPostFilterPlugin(t *testing.T) {
14151415
// Create the master and the scheduler with the test plugin set.
14161416
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "post-filter-plugin", nil), 2,
14171417
scheduler.WithFrameworkPlugins(plugins),
1418-
scheduler.WithFrameworkDefaultRegistry(registry))
1418+
scheduler.WithFrameworkInTreeRegistry(registry))
14191419
defer cleanupTest(t, context)
14201420

14211421
for _, fail := range []bool{false, true} {
@@ -1460,7 +1460,7 @@ func TestPreemptWithPermitPlugin(t *testing.T) {
14601460
// Create the master and the scheduler with the test plugin set.
14611461
context := initTestSchedulerForFrameworkTest(t, initTestMaster(t, "preempt-with-permit-plugin", nil), 0,
14621462
scheduler.WithFrameworkPlugins(plugins),
1463-
scheduler.WithFrameworkDefaultRegistry(registry))
1463+
scheduler.WithFrameworkInTreeRegistry(registry))
14641464
defer cleanupTest(t, context)
14651465

14661466
// Add one node.

0 commit comments

Comments
 (0)