Skip to content

Commit

Permalink
Merge pull request #117720 from kerthcet/feat/remove-selector-spread
Browse files Browse the repository at this point in the history
Remove deprecated selectorSpread
  • Loading branch information
k8s-ci-robot committed Aug 29, 2023
2 parents 27c9d32 + 855b445 commit cd91351
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 1,201 deletions.
2 changes: 1 addition & 1 deletion pkg/scheduler/apis/config/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ type invalidPlugins struct {
var invalidPluginsByVersion = []invalidPlugins{
{
schemeGroupVersion: v1.SchemeGroupVersion.String(),
plugins: []string{"SelectorSpread"},
plugins: []string{},
},
}

Expand Down
12 changes: 0 additions & 12 deletions pkg/scheduler/apis/config/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ func TestValidateKubeSchedulerConfigurationV1(t *testing.T) {
validPlugins := validConfig.DeepCopy()
validPlugins.Profiles[0].Plugins.Score.Enabled = append(validPlugins.Profiles[0].Plugins.Score.Enabled, config.Plugin{Name: "PodTopologySpread", Weight: 2})

invalidPlugins := validConfig.DeepCopy()
invalidPlugins.Profiles[0].Plugins.Score.Enabled = append(invalidPlugins.Profiles[0].Plugins.Score.Enabled, config.Plugin{Name: "SelectorSpread"})

scenarios := map[string]struct {
config *config.KubeSchedulerConfiguration
wantErrs field.ErrorList
Expand Down Expand Up @@ -394,15 +391,6 @@ func TestValidateKubeSchedulerConfigurationV1(t *testing.T) {
},
},
},
"invalid-plugins": {
config: invalidPlugins,
wantErrs: field.ErrorList{
&field.Error{
Type: field.ErrorTypeInvalid,
Field: "profiles[0].plugins.score.enabled[0]",
},
},
},
"valid-plugins": {
config: validPlugins,
},
Expand Down
1 change: 0 additions & 1 deletion pkg/scheduler/framework/plugins/names/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const (
GCEPDLimits = "GCEPDLimits"
PodTopologySpread = "PodTopologySpread"
SchedulingGates = "SchedulingGates"
SelectorSpread = "SelectorSpread"
TaintToleration = "TaintToleration"
VolumeBinding = "VolumeBinding"
VolumeRestrictions = "VolumeRestrictions"
Expand Down
80 changes: 0 additions & 80 deletions pkg/scheduler/framework/plugins/podtopologyspread/scoring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1442,83 +1442,3 @@ func BenchmarkTestPodTopologySpreadScore(b *testing.B) {
})
}
}

// The following test allows to compare PodTopologySpread.Score with
// SelectorSpread.Score by using a similar rule.
// See pkg/scheduler/framework/plugins/selectorspread/selector_spread_perf_test.go
// for the equivalent test.

var (
tests = []struct {
name string
existingPodsNum int
allNodesNum int
}{
{
name: "100nodes",
existingPodsNum: 1000,
allNodesNum: 100,
},
{
name: "1000nodes",
existingPodsNum: 10000,
allNodesNum: 1000,
},
{
name: "5000nodes",
existingPodsNum: 50000,
allNodesNum: 5000,
},
}
)

func BenchmarkTestDefaultEvenPodsSpreadPriority(b *testing.B) {
for _, tt := range tests {
b.Run(tt.name, func(b *testing.B) {
pod := st.MakePod().Name("p").Label("foo", "").Obj()
existingPods, allNodes, filteredNodes := st.MakeNodesAndPodsForEvenPodsSpread(pod.Labels, tt.existingPodsNum, tt.allNodesNum, tt.allNodesNum)
state := framework.NewCycleState()
snapshot := cache.NewSnapshot(existingPods, allNodes)
client := fake.NewSimpleClientset(
&v1.Service{Spec: v1.ServiceSpec{Selector: map[string]string{"foo": ""}}},
)
_, ctx := ktesting.NewTestContext(b)
ctx, cancel := context.WithCancel(ctx)
defer cancel()
informerFactory := informers.NewSharedInformerFactory(client, 0)
f, err := frameworkruntime.NewFramework(ctx, nil, nil,
frameworkruntime.WithSnapshotSharedLister(snapshot),
frameworkruntime.WithInformerFactory(informerFactory))
if err != nil {
b.Fatalf("Failed creating framework runtime: %v", err)
}
pl, err := New(&config.PodTopologySpreadArgs{DefaultingType: config.SystemDefaulting}, f, feature.Features{})
if err != nil {
b.Fatalf("Failed creating plugin: %v", err)
}
p := pl.(*PodTopologySpread)

informerFactory.Start(ctx.Done())
informerFactory.WaitForCacheSync(ctx.Done())
b.ResetTimer()

for i := 0; i < b.N; i++ {
status := p.PreScore(ctx, state, pod, filteredNodes)
if !status.IsSuccess() {
b.Fatalf("unexpected error: %v", status)
}
gotList := make(framework.NodeScoreList, len(filteredNodes))
scoreNode := func(i int) {
n := filteredNodes[i]
score, _ := p.Score(ctx, state, pod, n.Name)
gotList[i] = framework.NodeScore{Name: n.Name, Score: score}
}
p.parallelizer.Until(ctx, len(filteredNodes), scoreNode, "")
status = p.NormalizeScore(ctx, state, pod, gotList)
if !status.IsSuccess() {
b.Fatal(status)
}
}
})
}
}
2 changes: 0 additions & 2 deletions pkg/scheduler/framework/plugins/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/podtopologyspread"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/queuesort"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/schedulinggates"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/selectorspread"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/tainttoleration"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumerestrictions"
Expand All @@ -61,7 +60,6 @@ func NewInTreeRegistry() runtime.Registry {

registry := runtime.Registry{
dynamicresources.Name: runtime.FactoryAdapter(fts, dynamicresources.New),
selectorspread.Name: selectorspread.New,
imagelocality.Name: imagelocality.New,
tainttoleration.Name: tainttoleration.New,
nodename.Name: nodename.New,
Expand Down
234 changes: 0 additions & 234 deletions pkg/scheduler/framework/plugins/selectorspread/selector_spread.go

This file was deleted.

Loading

0 comments on commit cd91351

Please sign in to comment.