Skip to content

Commit b3033da

Browse files
authored
Merge pull request kubernetes#92200 from adtac/adtac/reserve
scheduler: merge Reserve and Unreserve plugins
2 parents 9859793 + ec83143 commit b3033da

File tree

23 files changed

+242
-287
lines changed

23 files changed

+242
-287
lines changed

cmd/kube-scheduler/app/server_test.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,9 @@ profiles:
198198
{Name: "TaintToleration", Weight: 1},
199199
{Name: "DefaultPodTopologySpread", Weight: 1},
200200
},
201-
"BindPlugin": {{Name: "DefaultBinder"}},
202-
"ReservePlugin": {{Name: "VolumeBinding"}},
203-
"UnreservePlugin": {{Name: "VolumeBinding"}},
204-
"PreBindPlugin": {{Name: "VolumeBinding"}},
201+
"BindPlugin": {{Name: "DefaultBinder"}},
202+
"ReservePlugin": {{Name: "VolumeBinding"}},
203+
"PreBindPlugin": {{Name: "VolumeBinding"}},
205204
}
206205

207206
testcases := []struct {
@@ -234,7 +233,6 @@ profiles:
234233
"QueueSortPlugin": {{Name: "PrioritySort"}},
235234
"ScorePlugin": {{Name: "InterPodAffinity", Weight: 1}, {Name: "TaintToleration", Weight: 1}},
236235
"ReservePlugin": {{Name: "VolumeBinding"}},
237-
"UnreservePlugin": {{Name: "VolumeBinding"}},
238236
"PreBindPlugin": {{Name: "VolumeBinding"}},
239237
},
240238
},
@@ -251,7 +249,6 @@ profiles:
251249
"BindPlugin": {{Name: "DefaultBinder"}},
252250
"QueueSortPlugin": {{Name: "PrioritySort"}},
253251
"ReservePlugin": {{Name: "VolumeBinding"}},
254-
"UnreservePlugin": {{Name: "VolumeBinding"}},
255252
"PreBindPlugin": {{Name: "VolumeBinding"}},
256253
},
257254
},
@@ -331,10 +328,9 @@ profiles:
331328
{Name: "TaintToleration", Weight: 1},
332329
{Name: "DefaultPodTopologySpread", Weight: 1},
333330
},
334-
"BindPlugin": {{Name: "DefaultBinder"}},
335-
"ReservePlugin": {{Name: "VolumeBinding"}},
336-
"UnreservePlugin": {{Name: "VolumeBinding"}},
337-
"PreBindPlugin": {{Name: "VolumeBinding"}},
331+
"BindPlugin": {{Name: "DefaultBinder"}},
332+
"ReservePlugin": {{Name: "VolumeBinding"}},
333+
"PreBindPlugin": {{Name: "VolumeBinding"}},
338334
},
339335
},
340336
},

pkg/scheduler/algorithmprovider/registry.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ func getDefaultConfig() *schedulerapi.Plugins {
142142
{Name: volumebinding.Name},
143143
},
144144
},
145-
Unreserve: &schedulerapi.PluginSet{
146-
Enabled: []schedulerapi.Plugin{
147-
{Name: volumebinding.Name},
148-
},
149-
},
150145
PreBind: &schedulerapi.PluginSet{
151146
Enabled: []schedulerapi.Plugin{
152147
{Name: volumebinding.Name},

pkg/scheduler/algorithmprovider/registry_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ func TestClusterAutoscalerProvider(t *testing.T) {
112112
{Name: volumebinding.Name},
113113
},
114114
},
115-
Unreserve: &schedulerapi.PluginSet{
116-
Enabled: []schedulerapi.Plugin{
117-
{Name: volumebinding.Name},
118-
},
119-
},
120115
PreBind: &schedulerapi.PluginSet{
121116
Enabled: []schedulerapi.Plugin{
122117
{Name: volumebinding.Name},
@@ -209,11 +204,6 @@ func TestApplyFeatureGates(t *testing.T) {
209204
{Name: volumebinding.Name},
210205
},
211206
},
212-
Unreserve: &schedulerapi.PluginSet{
213-
Enabled: []schedulerapi.Plugin{
214-
{Name: volumebinding.Name},
215-
},
216-
},
217207
PreBind: &schedulerapi.PluginSet{
218208
Enabled: []schedulerapi.Plugin{
219209
{Name: volumebinding.Name},
@@ -292,11 +282,6 @@ func TestApplyFeatureGates(t *testing.T) {
292282
{Name: volumebinding.Name},
293283
},
294284
},
295-
Unreserve: &schedulerapi.PluginSet{
296-
Enabled: []schedulerapi.Plugin{
297-
{Name: volumebinding.Name},
298-
},
299-
},
300285
PreBind: &schedulerapi.PluginSet{
301286
Enabled: []schedulerapi.Plugin{
302287
{Name: volumebinding.Name},

pkg/scheduler/apis/config/testing/compatibility_test.go

Lines changed: 30 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -702,10 +702,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
702702
{Name: "DefaultPodTopologySpread", Weight: 2},
703703
{Name: "TaintToleration", Weight: 2},
704704
},
705-
"BindPlugin": {{Name: "DefaultBinder"}},
706-
"ReservePlugin": {{Name: "VolumeBinding"}},
707-
"UnreservePlugin": {{Name: "VolumeBinding"}},
708-
"PreBindPlugin": {{Name: "VolumeBinding"}},
705+
"BindPlugin": {{Name: "DefaultBinder"}},
706+
"ReservePlugin": {{Name: "VolumeBinding"}},
707+
"PreBindPlugin": {{Name: "VolumeBinding"}},
709708
},
710709
wantExtenders: []config.Extender{{
711710
URLPrefix: "/prefix",
@@ -809,10 +808,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
809808
{Name: "DefaultPodTopologySpread", Weight: 2},
810809
{Name: "TaintToleration", Weight: 2},
811810
},
812-
"BindPlugin": {{Name: "DefaultBinder"}},
813-
"ReservePlugin": {{Name: "VolumeBinding"}},
814-
"UnreservePlugin": {{Name: "VolumeBinding"}},
815-
"PreBindPlugin": {{Name: "VolumeBinding"}},
811+
"BindPlugin": {{Name: "DefaultBinder"}},
812+
"ReservePlugin": {{Name: "VolumeBinding"}},
813+
"PreBindPlugin": {{Name: "VolumeBinding"}},
816814
},
817815
wantExtenders: []config.Extender{{
818816
URLPrefix: "/prefix",
@@ -929,10 +927,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
929927
{Name: "DefaultPodTopologySpread", Weight: 2},
930928
{Name: "TaintToleration", Weight: 2},
931929
},
932-
"BindPlugin": {{Name: "DefaultBinder"}},
933-
"ReservePlugin": {{Name: "VolumeBinding"}},
934-
"UnreservePlugin": {{Name: "VolumeBinding"}},
935-
"PreBindPlugin": {{Name: "VolumeBinding"}},
930+
"BindPlugin": {{Name: "DefaultBinder"}},
931+
"ReservePlugin": {{Name: "VolumeBinding"}},
932+
"PreBindPlugin": {{Name: "VolumeBinding"}},
936933
},
937934
wantExtenders: []config.Extender{{
938935
URLPrefix: "/prefix",
@@ -1051,10 +1048,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
10511048
{Name: "DefaultPodTopologySpread", Weight: 2},
10521049
{Name: "TaintToleration", Weight: 2},
10531050
},
1054-
"BindPlugin": {{Name: "DefaultBinder"}},
1055-
"ReservePlugin": {{Name: "VolumeBinding"}},
1056-
"UnreservePlugin": {{Name: "VolumeBinding"}},
1057-
"PreBindPlugin": {{Name: "VolumeBinding"}},
1051+
"BindPlugin": {{Name: "DefaultBinder"}},
1052+
"ReservePlugin": {{Name: "VolumeBinding"}},
1053+
"PreBindPlugin": {{Name: "VolumeBinding"}},
10581054
},
10591055
wantExtenders: []config.Extender{{
10601056
URLPrefix: "/prefix",
@@ -1173,10 +1169,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
11731169
{Name: "DefaultPodTopologySpread", Weight: 2},
11741170
{Name: "TaintToleration", Weight: 2},
11751171
},
1176-
"BindPlugin": {{Name: "DefaultBinder"}},
1177-
"ReservePlugin": {{Name: "VolumeBinding"}},
1178-
"UnreservePlugin": {{Name: "VolumeBinding"}},
1179-
"PreBindPlugin": {{Name: "VolumeBinding"}},
1172+
"BindPlugin": {{Name: "DefaultBinder"}},
1173+
"ReservePlugin": {{Name: "VolumeBinding"}},
1174+
"PreBindPlugin": {{Name: "VolumeBinding"}},
11801175
},
11811176
wantExtenders: []config.Extender{{
11821177
URLPrefix: "/prefix",
@@ -1299,10 +1294,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
12991294
{Name: "DefaultPodTopologySpread", Weight: 2},
13001295
{Name: "TaintToleration", Weight: 2},
13011296
},
1302-
"BindPlugin": {{Name: "DefaultBinder"}},
1303-
"ReservePlugin": {{Name: "VolumeBinding"}},
1304-
"UnreservePlugin": {{Name: "VolumeBinding"}},
1305-
"PreBindPlugin": {{Name: "VolumeBinding"}},
1297+
"BindPlugin": {{Name: "DefaultBinder"}},
1298+
"ReservePlugin": {{Name: "VolumeBinding"}},
1299+
"PreBindPlugin": {{Name: "VolumeBinding"}},
13061300
},
13071301
wantExtenders: []config.Extender{{
13081302
URLPrefix: "/prefix",
@@ -1428,10 +1422,9 @@ func TestAlgorithmProviderCompatibility(t *testing.T) {
14281422
{Name: "TaintToleration", Weight: 1},
14291423
{Name: "DefaultPodTopologySpread", Weight: 1},
14301424
},
1431-
"BindPlugin": {{Name: "DefaultBinder"}},
1432-
"ReservePlugin": {{Name: "VolumeBinding"}},
1433-
"UnreservePlugin": {{Name: "VolumeBinding"}},
1434-
"PreBindPlugin": {{Name: "VolumeBinding"}},
1425+
"BindPlugin": {{Name: "DefaultBinder"}},
1426+
"ReservePlugin": {{Name: "VolumeBinding"}},
1427+
"PreBindPlugin": {{Name: "VolumeBinding"}},
14351428
}
14361429

14371430
testcases := []struct {
@@ -1499,10 +1492,9 @@ func TestAlgorithmProviderCompatibility(t *testing.T) {
14991492
{Name: "TaintToleration", Weight: 1},
15001493
{Name: "DefaultPodTopologySpread", Weight: 1},
15011494
},
1502-
"ReservePlugin": {{Name: "VolumeBinding"}},
1503-
"UnreservePlugin": {{Name: "VolumeBinding"}},
1504-
"PreBindPlugin": {{Name: "VolumeBinding"}},
1505-
"BindPlugin": {{Name: "DefaultBinder"}},
1495+
"ReservePlugin": {{Name: "VolumeBinding"}},
1496+
"PreBindPlugin": {{Name: "VolumeBinding"}},
1497+
"BindPlugin": {{Name: "DefaultBinder"}},
15061498
},
15071499
},
15081500
}
@@ -1590,10 +1582,9 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
15901582
{Name: "TaintToleration", Weight: 1},
15911583
{Name: "DefaultPodTopologySpread", Weight: 1},
15921584
},
1593-
"ReservePlugin": {{Name: "VolumeBinding"}},
1594-
"UnreservePlugin": {{Name: "VolumeBinding"}},
1595-
"PreBindPlugin": {{Name: "VolumeBinding"}},
1596-
"BindPlugin": {{Name: "DefaultBinder"}},
1585+
"ReservePlugin": {{Name: "VolumeBinding"}},
1586+
"PreBindPlugin": {{Name: "VolumeBinding"}},
1587+
"BindPlugin": {{Name: "DefaultBinder"}},
15971588
}
15981589

15991590
testcases := []struct {
@@ -1812,11 +1803,6 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
18121803
{Name: "VolumeBinding"},
18131804
},
18141805
},
1815-
Unreserve: &config.PluginSet{
1816-
Disabled: []config.Plugin{
1817-
{Name: "VolumeBinding"},
1818-
},
1819-
},
18201806
},
18211807
wantPlugins: map[string][]config.Plugin{
18221808
"QueueSortPlugin": {
@@ -1940,10 +1926,9 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
19401926
{Name: "ImageLocality", Weight: 24},
19411927
{Name: "NodeResourcesBalancedAllocation", Weight: 24},
19421928
},
1943-
"ReservePlugin": {{Name: "VolumeBinding"}},
1944-
"UnreservePlugin": {{Name: "VolumeBinding"}},
1945-
"PreBindPlugin": {{Name: "VolumeBinding"}},
1946-
"BindPlugin": {{Name: "DefaultBinder"}},
1929+
"ReservePlugin": {{Name: "VolumeBinding"}},
1930+
"PreBindPlugin": {{Name: "VolumeBinding"}},
1931+
"BindPlugin": {{Name: "DefaultBinder"}},
19471932
},
19481933
wantPluginConfig: nil,
19491934
},

pkg/scheduler/apis/config/types.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ type Plugins struct {
192192
// Score is a list of plugins that should be invoked when ranking nodes that have passed the filtering phase.
193193
Score *PluginSet
194194

195-
// Reserve is a list of plugins invoked when reserving a node to run the pod.
195+
// Reserve is a list of plugins invoked when reserving/unreserving resources
196+
// after a node is assigned to run the pod.
196197
Reserve *PluginSet
197198

198199
// Permit is a list of plugins that control binding of a Pod. These plugins can prevent or delay binding of a Pod.
@@ -207,9 +208,6 @@ type Plugins struct {
207208

208209
// PostBind is a list of plugins that should be invoked after a pod is successfully bound.
209210
PostBind *PluginSet
210-
211-
// Unreserve is a list of plugins invoked when a pod that was previously reserved is rejected in a later phase.
212-
Unreserve *PluginSet
213211
}
214212

215213
// PluginSet specifies enabled and disabled plugins for an extension point.
@@ -288,7 +286,6 @@ func (p *Plugins) Append(src *Plugins) {
288286
p.PreBind = appendPluginSet(p.PreBind, src.PreBind)
289287
p.Bind = appendPluginSet(p.Bind, src.Bind)
290288
p.PostBind = appendPluginSet(p.PostBind, src.PostBind)
291-
p.Unreserve = appendPluginSet(p.Unreserve, src.Unreserve)
292289
}
293290

294291
// Apply merges the plugin configuration from custom plugins, handling disabled sets.
@@ -308,7 +305,6 @@ func (p *Plugins) Apply(customPlugins *Plugins) {
308305
p.PreBind = mergePluginSets(p.PreBind, customPlugins.PreBind)
309306
p.Bind = mergePluginSets(p.Bind, customPlugins.Bind)
310307
p.PostBind = mergePluginSets(p.PostBind, customPlugins.PostBind)
311-
p.Unreserve = mergePluginSets(p.Unreserve, customPlugins.Unreserve)
312308
}
313309

314310
func mergePluginSets(defaultPluginSet, customPluginSet *PluginSet) *PluginSet {

pkg/scheduler/apis/config/types_test.go

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ func TestPluginsAppend(t *testing.T) {
6464
PreBind: &PluginSet{},
6565
Bind: &PluginSet{},
6666
PostBind: &PluginSet{},
67-
Unreserve: &PluginSet{},
6867
},
6968
},
7069
{
@@ -126,7 +125,6 @@ func TestPluginsApply(t *testing.T) {
126125
PreBind: &PluginSet{Enabled: []Plugin{}},
127126
Bind: &PluginSet{Enabled: []Plugin{}},
128127
PostBind: &PluginSet{Enabled: []Plugin{}},
129-
Unreserve: &PluginSet{Enabled: []Plugin{}},
130128
},
131129
},
132130
{
@@ -168,7 +166,6 @@ func TestPluginsApply(t *testing.T) {
168166
PreBind: &PluginSet{Enabled: []Plugin{}},
169167
Bind: &PluginSet{Enabled: []Plugin{}},
170168
PostBind: &PluginSet{Enabled: []Plugin{}},
171-
Unreserve: &PluginSet{Enabled: []Plugin{}},
172169
},
173170
},
174171
{
@@ -211,7 +208,6 @@ func TestPluginsApply(t *testing.T) {
211208
PreBind: &PluginSet{Enabled: []Plugin{}},
212209
Bind: &PluginSet{Enabled: []Plugin{}},
213210
PostBind: &PluginSet{Enabled: []Plugin{}},
214-
Unreserve: &PluginSet{Enabled: []Plugin{}},
215211
},
216212
},
217213
{
@@ -252,7 +248,6 @@ func TestPluginsApply(t *testing.T) {
252248
PreBind: &PluginSet{Enabled: []Plugin{}},
253249
Bind: &PluginSet{Enabled: []Plugin{}},
254250
PostBind: &PluginSet{Enabled: []Plugin{}},
255-
Unreserve: &PluginSet{Enabled: []Plugin{}},
256251
},
257252
},
258253
{
@@ -275,14 +270,13 @@ func TestPluginsApply(t *testing.T) {
275270
{Name: "DefaultPlugin2"},
276271
},
277272
},
278-
PreScore: nil,
279-
Score: nil,
280-
Reserve: nil,
281-
Permit: nil,
282-
PreBind: nil,
283-
Bind: nil,
284-
PostBind: nil,
285-
Unreserve: nil,
273+
PreScore: nil,
274+
Score: nil,
275+
Reserve: nil,
276+
Permit: nil,
277+
PreBind: nil,
278+
Bind: nil,
279+
PostBind: nil,
286280
},
287281
},
288282
}

pkg/scheduler/apis/config/v1beta1/zz_generated.conversion.go

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/scheduler/apis/config/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)