@@ -44,24 +44,21 @@ var (
44
44
testCSIDriver = plugins .AWSEBSDriverName
45
45
// From PV controller
46
46
annBindCompleted = "pv.kubernetes.io/bind-completed"
47
+
48
+ tests = []struct { nodes , existingPods , minPods int }{
49
+ {nodes : 500 , existingPods : 500 , minPods : 1000 },
50
+ {nodes : 5000 , existingPods : 5000 , minPods : 1000 },
51
+ }
47
52
)
48
53
49
54
// BenchmarkScheduling benchmarks the scheduling rate when the cluster has
50
55
// various quantities of nodes and scheduled pods.
51
56
func BenchmarkScheduling (b * testing.B ) {
52
- tests := []struct { nodes , existingPods , minPods int }{
53
- {nodes : 100 , existingPods : 0 , minPods : 100 },
54
- {nodes : 100 , existingPods : 1000 , minPods : 100 },
55
- {nodes : 1000 , existingPods : 0 , minPods : 100 },
56
- {nodes : 1000 , existingPods : 1000 , minPods : 100 },
57
- {nodes : 5000 , existingPods : 1000 , minPods : 1000 },
58
- }
59
- setupStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("rc1" )
60
- testStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("rc2" )
57
+ testStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("rc1" )
61
58
for _ , test := range tests {
62
59
name := fmt .Sprintf ("%vNodes/%vPods" , test .nodes , test .existingPods )
63
60
b .Run (name , func (b * testing.B ) {
64
- benchmarkScheduling (test .nodes , test .existingPods , test .minPods , defaultNodeStrategy , setupStrategy , testStrategy , b )
61
+ benchmarkScheduling (test .nodes , test .existingPods , test .minPods , defaultNodeStrategy , testStrategy , b )
65
62
})
66
63
}
67
64
}
@@ -70,14 +67,6 @@ func BenchmarkScheduling(b *testing.B) {
70
67
// PodAntiAffinity rules when the cluster has various quantities of nodes and
71
68
// scheduled pods.
72
69
func BenchmarkSchedulingPodAntiAffinity (b * testing.B ) {
73
- tests := []struct { nodes , existingPods , minPods int }{
74
- {nodes : 500 , existingPods : 250 , minPods : 250 },
75
- {nodes : 500 , existingPods : 5000 , minPods : 250 },
76
- {nodes : 1000 , existingPods : 1000 , minPods : 500 },
77
- {nodes : 5000 , existingPods : 1000 , minPods : 1000 },
78
- }
79
- // The setup strategy creates pods with no affinity rules.
80
- setupStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("setup" )
81
70
testBasePod := makeBasePodWithPodAntiAffinity (
82
71
map [string ]string {"name" : "test" , "color" : "green" },
83
72
map [string ]string {"color" : "green" })
@@ -86,7 +75,7 @@ func BenchmarkSchedulingPodAntiAffinity(b *testing.B) {
86
75
for _ , test := range tests {
87
76
name := fmt .Sprintf ("%vNodes/%vPods" , test .nodes , test .existingPods )
88
77
b .Run (name , func (b * testing.B ) {
89
- benchmarkScheduling (test .nodes , test .existingPods , test .minPods , defaultNodeStrategy , setupStrategy , testStrategy , b )
78
+ benchmarkScheduling (test .nodes , test .existingPods , test .minPods , defaultNodeStrategy , testStrategy , b )
90
79
})
91
80
}
92
81
}
@@ -96,21 +85,13 @@ func BenchmarkSchedulingPodAntiAffinity(b *testing.B) {
96
85
// It can be used to compare scheduler efficiency with the other benchmarks
97
86
// that use volume scheduling predicates.
98
87
func BenchmarkSchedulingSecrets (b * testing.B ) {
99
- tests := []struct { nodes , existingPods , minPods int }{
100
- {nodes : 500 , existingPods : 250 , minPods : 250 },
101
- {nodes : 500 , existingPods : 5000 , minPods : 250 },
102
- {nodes : 1000 , existingPods : 1000 , minPods : 500 },
103
- {nodes : 5000 , existingPods : 1000 , minPods : 1000 },
104
- }
105
- // The setup strategy creates pods with no volumes.
106
- setupStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("setup" )
107
88
// The test strategy creates pods with a secret.
108
89
testBasePod := makeBasePodWithSecret ()
109
90
testStrategy := testutils .NewCustomCreatePodStrategy (testBasePod )
110
91
for _ , test := range tests {
111
92
name := fmt .Sprintf ("%vNodes/%vPods" , test .nodes , test .existingPods )
112
93
b .Run (name , func (b * testing.B ) {
113
- benchmarkScheduling (test .nodes , test .existingPods , test .minPods , defaultNodeStrategy , setupStrategy , testStrategy , b )
94
+ benchmarkScheduling (test .nodes , test .existingPods , test .minPods , defaultNodeStrategy , testStrategy , b )
114
95
})
115
96
}
116
97
}
@@ -119,23 +100,14 @@ func BenchmarkSchedulingSecrets(b *testing.B) {
119
100
// in-tree volumes (used via PV/PVC). Nodes have default hardcoded attach limits
120
101
// (39 for AWS EBS).
121
102
func BenchmarkSchedulingInTreePVs (b * testing.B ) {
122
- tests := []struct { nodes , existingPods , minPods int }{
123
- {nodes : 500 , existingPods : 250 , minPods : 250 },
124
- {nodes : 500 , existingPods : 5000 , minPods : 250 },
125
- {nodes : 1000 , existingPods : 1000 , minPods : 500 },
126
- {nodes : 5000 , existingPods : 1000 , minPods : 1000 },
127
- }
128
- // The setup strategy creates pods with no volumes.
129
- setupStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("setup" )
130
-
131
103
// The test strategy creates pods with AWS EBS volume used via PV.
132
104
baseClaim := makeBasePersistentVolumeClaim ()
133
105
basePod := makeBasePod ()
134
106
testStrategy := testutils .NewCreatePodWithPersistentVolumeStrategy (baseClaim , awsVolumeFactory , basePod )
135
107
for _ , test := range tests {
136
108
name := fmt .Sprintf ("%vNodes/%vPods" , test .nodes , test .existingPods )
137
109
b .Run (name , func (b * testing.B ) {
138
- benchmarkScheduling (test .nodes , test .existingPods , test .minPods , defaultNodeStrategy , setupStrategy , testStrategy , b )
110
+ benchmarkScheduling (test .nodes , test .existingPods , test .minPods , defaultNodeStrategy , testStrategy , b )
139
111
})
140
112
}
141
113
}
@@ -144,15 +116,6 @@ func BenchmarkSchedulingInTreePVs(b *testing.B) {
144
116
// in-tree volumes (used via PV/PVC) that are migrated to CSI. CSINode instances exist
145
117
// for all nodes and have proper annotation that AWS is migrated.
146
118
func BenchmarkSchedulingMigratedInTreePVs (b * testing.B ) {
147
- tests := []struct { nodes , existingPods , minPods int }{
148
- {nodes : 500 , existingPods : 250 , minPods : 250 },
149
- {nodes : 500 , existingPods : 5000 , minPods : 250 },
150
- {nodes : 1000 , existingPods : 1000 , minPods : 500 },
151
- {nodes : 5000 , existingPods : 1000 , minPods : 1000 },
152
- }
153
- // The setup strategy creates pods with no volumes.
154
- setupStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("setup" )
155
-
156
119
// The test strategy creates pods with AWS EBS volume used via PV.
157
120
baseClaim := makeBasePersistentVolumeClaim ()
158
121
basePod := makeBasePod ()
@@ -176,23 +139,13 @@ func BenchmarkSchedulingMigratedInTreePVs(b *testing.B) {
176
139
b .Run (name , func (b * testing.B ) {
177
140
defer featuregatetesting .SetFeatureGateDuringTest (b , utilfeature .DefaultFeatureGate , features .CSIMigration , true )()
178
141
defer featuregatetesting .SetFeatureGateDuringTest (b , utilfeature .DefaultFeatureGate , features .CSIMigrationAWS , true )()
179
- benchmarkScheduling (test .nodes , test .existingPods , test .minPods , nodeStrategy , setupStrategy , testStrategy , b )
142
+ benchmarkScheduling (test .nodes , test .existingPods , test .minPods , nodeStrategy , testStrategy , b )
180
143
})
181
144
}
182
145
}
183
146
184
147
// node.status.allocatable.
185
148
func BenchmarkSchedulingCSIPVs (b * testing.B ) {
186
- tests := []struct { nodes , existingPods , minPods int }{
187
- {nodes : 500 , existingPods : 250 , minPods : 250 },
188
- {nodes : 500 , existingPods : 5000 , minPods : 250 },
189
- {nodes : 1000 , existingPods : 1000 , minPods : 500 },
190
- {nodes : 5000 , existingPods : 1000 , minPods : 1000 },
191
- }
192
-
193
- // The setup strategy creates pods with no volumes.
194
- setupStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("setup" )
195
-
196
149
// The test strategy creates pods with CSI volume via PV.
197
150
baseClaim := makeBasePersistentVolumeClaim ()
198
151
basePod := makeBasePod ()
@@ -214,7 +167,7 @@ func BenchmarkSchedulingCSIPVs(b *testing.B) {
214
167
for _ , test := range tests {
215
168
name := fmt .Sprintf ("%vNodes/%vPods" , test .nodes , test .existingPods )
216
169
b .Run (name , func (b * testing.B ) {
217
- benchmarkScheduling (test .nodes , test .existingPods , test .minPods , nodeStrategy , setupStrategy , testStrategy , b )
170
+ benchmarkScheduling (test .nodes , test .existingPods , test .minPods , nodeStrategy , testStrategy , b )
218
171
})
219
172
}
220
173
}
@@ -223,14 +176,6 @@ func BenchmarkSchedulingCSIPVs(b *testing.B) {
223
176
// PodAffinity rules when the cluster has various quantities of nodes and
224
177
// scheduled pods.
225
178
func BenchmarkSchedulingPodAffinity (b * testing.B ) {
226
- tests := []struct { nodes , existingPods , minPods int }{
227
- {nodes : 500 , existingPods : 250 , minPods : 250 },
228
- {nodes : 500 , existingPods : 5000 , minPods : 250 },
229
- {nodes : 1000 , existingPods : 1000 , minPods : 500 },
230
- {nodes : 5000 , existingPods : 1000 , minPods : 1000 },
231
- }
232
- // The setup strategy creates pods with no affinity rules.
233
- setupStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("setup" )
234
179
testBasePod := makeBasePodWithPodAffinity (
235
180
map [string ]string {"foo" : "" },
236
181
map [string ]string {"foo" : "" },
@@ -241,7 +186,7 @@ func BenchmarkSchedulingPodAffinity(b *testing.B) {
241
186
for _ , test := range tests {
242
187
name := fmt .Sprintf ("%vNodes/%vPods" , test .nodes , test .existingPods )
243
188
b .Run (name , func (b * testing.B ) {
244
- benchmarkScheduling (test .nodes , test .existingPods , test .minPods , nodeStrategy , setupStrategy , testStrategy , b )
189
+ benchmarkScheduling (test .nodes , test .existingPods , test .minPods , nodeStrategy , testStrategy , b )
245
190
})
246
191
}
247
192
}
@@ -250,22 +195,14 @@ func BenchmarkSchedulingPodAffinity(b *testing.B) {
250
195
// NodeAffinity rules when the cluster has various quantities of nodes and
251
196
// scheduled pods.
252
197
func BenchmarkSchedulingNodeAffinity (b * testing.B ) {
253
- tests := []struct { nodes , existingPods , minPods int }{
254
- {nodes : 500 , existingPods : 250 , minPods : 250 },
255
- {nodes : 500 , existingPods : 5000 , minPods : 250 },
256
- {nodes : 1000 , existingPods : 1000 , minPods : 500 },
257
- {nodes : 5000 , existingPods : 1000 , minPods : 1000 },
258
- }
259
- // The setup strategy creates pods with no affinity rules.
260
- setupStrategy := testutils .NewSimpleWithControllerCreatePodStrategy ("setup" )
261
198
testBasePod := makeBasePodWithNodeAffinity (v1 .LabelZoneFailureDomain , []string {"zone1" , "zone2" })
262
199
// The test strategy creates pods with node-affinity for each other.
263
200
testStrategy := testutils .NewCustomCreatePodStrategy (testBasePod )
264
201
nodeStrategy := testutils .NewLabelNodePrepareStrategy (v1 .LabelZoneFailureDomain , "zone1" )
265
202
for _ , test := range tests {
266
203
name := fmt .Sprintf ("%vNodes/%vPods" , test .nodes , test .existingPods )
267
204
b .Run (name , func (b * testing.B ) {
268
- benchmarkScheduling (test .nodes , test .existingPods , test .minPods , nodeStrategy , setupStrategy , testStrategy , b )
205
+ benchmarkScheduling (test .nodes , test .existingPods , test .minPods , nodeStrategy , testStrategy , b )
269
206
})
270
207
}
271
208
}
@@ -355,7 +292,7 @@ func makeBasePodWithNodeAffinity(key string, vals []string) *v1.Pod {
355
292
// least minPods pods during the benchmark.
356
293
func benchmarkScheduling (numNodes , numExistingPods , minPods int ,
357
294
nodeStrategy testutils.PrepareNodeStrategy ,
358
- setupPodStrategy , testPodStrategy testutils.TestPodCreateStrategy ,
295
+ testPodStrategy testutils.TestPodCreateStrategy ,
359
296
b * testing.B ) {
360
297
if b .N < minPods {
361
298
b .N = minPods
@@ -374,7 +311,7 @@ func benchmarkScheduling(numNodes, numExistingPods, minPods int,
374
311
defer nodePreparer .CleanupNodes ()
375
312
376
313
config := testutils .NewTestPodCreatorConfig ()
377
- config .AddStrategy ("sched-test " , numExistingPods , setupPodStrategy )
314
+ config .AddStrategy ("sched-setup " , numExistingPods , testPodStrategy )
378
315
podCreator := testutils .NewTestPodCreator (clientset , config )
379
316
podCreator .CreatePods ()
380
317
0 commit comments