Skip to content

Commit 5bda0c1

Browse files
authored
Merge pull request kubernetes#83726 from cofyc/fix56180
scheduler: Move all volume binding code into VolumeBinding plugin
2 parents 438debf + 85a8740 commit 5bda0c1

File tree

20 files changed

+632
-122
lines changed

20 files changed

+632
-122
lines changed

cmd/kube-scheduler/app/server_test.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ profiles:
191191
{Name: "TaintToleration", Weight: 1},
192192
{Name: "PodTopologySpread", Weight: 1},
193193
},
194-
"BindPlugin": {{Name: "DefaultBinder"}},
194+
"BindPlugin": {{Name: "DefaultBinder"}},
195+
"ReservePlugin": {{Name: "VolumeBinding"}},
196+
"UnreservePlugin": {{Name: "VolumeBinding"}},
197+
"PreBindPlugin": {{Name: "VolumeBinding"}},
198+
"PostBindPlugin": {{Name: "VolumeBinding"}},
195199
}
196200

197201
testcases := []struct {
@@ -222,6 +226,10 @@ profiles:
222226
"PreScorePlugin": {{Name: "InterPodAffinity"}, {Name: "TaintToleration"}},
223227
"QueueSortPlugin": {{Name: "PrioritySort"}},
224228
"ScorePlugin": {{Name: "InterPodAffinity", Weight: 1}, {Name: "TaintToleration", Weight: 1}},
229+
"ReservePlugin": {{Name: "VolumeBinding"}},
230+
"UnreservePlugin": {{Name: "VolumeBinding"}},
231+
"PreBindPlugin": {{Name: "VolumeBinding"}},
232+
"PostBindPlugin": {{Name: "VolumeBinding"}},
225233
},
226234
},
227235
},
@@ -236,6 +244,10 @@ profiles:
236244
"profile-disable-all-filter-and-score-plugins": {
237245
"BindPlugin": {{Name: "DefaultBinder"}},
238246
"QueueSortPlugin": {{Name: "PrioritySort"}},
247+
"ReservePlugin": {{Name: "VolumeBinding"}},
248+
"UnreservePlugin": {{Name: "VolumeBinding"}},
249+
"PreBindPlugin": {{Name: "VolumeBinding"}},
250+
"PostBindPlugin": {{Name: "VolumeBinding"}},
239251
},
240252
},
241253
},
@@ -310,7 +322,11 @@ profiles:
310322
{Name: "TaintToleration", Weight: 1},
311323
{Name: "PodTopologySpread", Weight: 1},
312324
},
313-
"BindPlugin": {{Name: "DefaultBinder"}},
325+
"BindPlugin": {{Name: "DefaultBinder"}},
326+
"ReservePlugin": {{Name: "VolumeBinding"}},
327+
"UnreservePlugin": {{Name: "VolumeBinding"}},
328+
"PreBindPlugin": {{Name: "VolumeBinding"}},
329+
"PostBindPlugin": {{Name: "VolumeBinding"}},
314330
},
315331
},
316332
},

pkg/scheduler/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ go_library(
1111
visibility = ["//visibility:public"],
1212
deps = [
1313
"//pkg/api/v1/pod:go_default_library",
14-
"//pkg/controller/volume/scheduling:go_default_library",
1514
"//pkg/features:go_default_library",
1615
"//pkg/scheduler/algorithmprovider:go_default_library",
1716
"//pkg/scheduler/apis/config:go_default_library",
@@ -22,6 +21,7 @@ go_library(
2221
"//pkg/scheduler/framework/plugins/defaultbinder:go_default_library",
2322
"//pkg/scheduler/framework/plugins/noderesources:go_default_library",
2423
"//pkg/scheduler/framework/plugins/queuesort:go_default_library",
24+
"//pkg/scheduler/framework/plugins/volumebinding:go_default_library",
2525
"//pkg/scheduler/framework/v1alpha1:go_default_library",
2626
"//pkg/scheduler/internal/cache:go_default_library",
2727
"//pkg/scheduler/internal/cache/debugger:go_default_library",

pkg/scheduler/algorithmprovider/registry.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,31 @@ func getDefaultConfig() *schedulerapi.Plugins {
125125
{Name: tainttoleration.Name, Weight: 1},
126126
},
127127
},
128+
Reserve: &schedulerapi.PluginSet{
129+
Enabled: []schedulerapi.Plugin{
130+
{Name: volumebinding.Name},
131+
},
132+
},
133+
Unreserve: &schedulerapi.PluginSet{
134+
Enabled: []schedulerapi.Plugin{
135+
{Name: volumebinding.Name},
136+
},
137+
},
138+
PreBind: &schedulerapi.PluginSet{
139+
Enabled: []schedulerapi.Plugin{
140+
{Name: volumebinding.Name},
141+
},
142+
},
128143
Bind: &schedulerapi.PluginSet{
129144
Enabled: []schedulerapi.Plugin{
130145
{Name: defaultbinder.Name},
131146
},
132147
},
148+
PostBind: &schedulerapi.PluginSet{
149+
Enabled: []schedulerapi.Plugin{
150+
{Name: volumebinding.Name},
151+
},
152+
},
133153
}
134154
}
135155

pkg/scheduler/algorithmprovider/registry_test.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,31 @@ func TestClusterAutoscalerProvider(t *testing.T) {
9999
{Name: podtopologyspread.Name, Weight: 1},
100100
},
101101
},
102+
Reserve: &schedulerapi.PluginSet{
103+
Enabled: []schedulerapi.Plugin{
104+
{Name: volumebinding.Name},
105+
},
106+
},
107+
Unreserve: &schedulerapi.PluginSet{
108+
Enabled: []schedulerapi.Plugin{
109+
{Name: volumebinding.Name},
110+
},
111+
},
112+
PreBind: &schedulerapi.PluginSet{
113+
Enabled: []schedulerapi.Plugin{
114+
{Name: volumebinding.Name},
115+
},
116+
},
102117
Bind: &schedulerapi.PluginSet{
103118
Enabled: []schedulerapi.Plugin{
104119
{Name: defaultbinder.Name},
105120
},
106121
},
122+
PostBind: &schedulerapi.PluginSet{
123+
Enabled: []schedulerapi.Plugin{
124+
{Name: volumebinding.Name},
125+
},
126+
},
107127
}
108128

109129
r := NewRegistry()
@@ -172,11 +192,31 @@ func TestApplyFeatureGates(t *testing.T) {
172192
{Name: tainttoleration.Name, Weight: 1},
173193
},
174194
},
195+
Reserve: &schedulerapi.PluginSet{
196+
Enabled: []schedulerapi.Plugin{
197+
{Name: volumebinding.Name},
198+
},
199+
},
200+
Unreserve: &schedulerapi.PluginSet{
201+
Enabled: []schedulerapi.Plugin{
202+
{Name: volumebinding.Name},
203+
},
204+
},
205+
PreBind: &schedulerapi.PluginSet{
206+
Enabled: []schedulerapi.Plugin{
207+
{Name: volumebinding.Name},
208+
},
209+
},
175210
Bind: &schedulerapi.PluginSet{
176211
Enabled: []schedulerapi.Plugin{
177212
{Name: defaultbinder.Name},
178213
},
179214
},
215+
PostBind: &schedulerapi.PluginSet{
216+
Enabled: []schedulerapi.Plugin{
217+
{Name: volumebinding.Name},
218+
},
219+
},
180220
},
181221
},
182222
{
@@ -238,11 +278,31 @@ func TestApplyFeatureGates(t *testing.T) {
238278
{Name: noderesources.ResourceLimitsName, Weight: 1},
239279
},
240280
},
281+
Reserve: &schedulerapi.PluginSet{
282+
Enabled: []schedulerapi.Plugin{
283+
{Name: volumebinding.Name},
284+
},
285+
},
286+
Unreserve: &schedulerapi.PluginSet{
287+
Enabled: []schedulerapi.Plugin{
288+
{Name: volumebinding.Name},
289+
},
290+
},
291+
PreBind: &schedulerapi.PluginSet{
292+
Enabled: []schedulerapi.Plugin{
293+
{Name: volumebinding.Name},
294+
},
295+
},
241296
Bind: &schedulerapi.PluginSet{
242297
Enabled: []schedulerapi.Plugin{
243298
{Name: defaultbinder.Name},
244299
},
245300
},
301+
PostBind: &schedulerapi.PluginSet{
302+
Enabled: []schedulerapi.Plugin{
303+
{Name: volumebinding.Name},
304+
},
305+
},
246306
},
247307
},
248308
}

pkg/scheduler/apis/config/register.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
4545
&PodTopologySpreadArgs{},
4646
&RequestedToCapacityRatioArgs{},
4747
&ServiceAffinityArgs{},
48+
&VolumeBindingArgs{},
4849
)
4950
scheme.AddKnownTypes(schema.GroupVersion{Group: "", Version: runtime.APIVersionInternal}, &Policy{})
5051
return nil

0 commit comments

Comments
 (0)