@@ -90,7 +90,7 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
90
90
91
91
p , err := factory (pc , f )
92
92
if err != nil {
93
- return nil , fmt .Errorf ("error initializing plugin %v : %v" , name , err )
93
+ return nil , fmt .Errorf ("error initializing plugin %q : %v" , name , err )
94
94
}
95
95
pluginsMap [name ] = p
96
96
@@ -107,11 +107,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
107
107
if pg , ok := pluginsMap [pf .Name ]; ok {
108
108
p , ok := pg .(PrefilterPlugin )
109
109
if ! ok {
110
- return nil , fmt .Errorf ("plugin %v does not extend prefilter plugin" , pf .Name )
110
+ return nil , fmt .Errorf ("plugin %q does not extend prefilter plugin" , pf .Name )
111
111
}
112
112
f .prefilterPlugins = append (f .prefilterPlugins , p )
113
113
} else {
114
- return nil , fmt .Errorf ("prefilter plugin %v does not exist" , pf .Name )
114
+ return nil , fmt .Errorf ("prefilter plugin %q does not exist" , pf .Name )
115
115
}
116
116
}
117
117
}
@@ -121,11 +121,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
121
121
if pg , ok := pluginsMap [r .Name ]; ok {
122
122
p , ok := pg .(FilterPlugin )
123
123
if ! ok {
124
- return nil , fmt .Errorf ("plugin %v does not extend filter plugin" , r .Name )
124
+ return nil , fmt .Errorf ("plugin %q does not extend filter plugin" , r .Name )
125
125
}
126
126
f .filterPlugins = append (f .filterPlugins , p )
127
127
} else {
128
- return nil , fmt .Errorf ("filter plugin %v does not exist" , r .Name )
128
+ return nil , fmt .Errorf ("filter plugin %q does not exist" , r .Name )
129
129
}
130
130
}
131
131
}
@@ -136,10 +136,10 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
136
136
// First, make sure the plugin implements ScorePlugin interface.
137
137
p , ok := pg .(ScorePlugin )
138
138
if ! ok {
139
- return nil , fmt .Errorf ("plugin %v does not extend score plugin" , sc .Name )
139
+ return nil , fmt .Errorf ("plugin %q does not extend score plugin" , sc .Name )
140
140
}
141
141
if f .pluginNameToWeightMap [p .Name ()] == 0 {
142
- return nil , fmt .Errorf ("score plugin %v is not configured with weight" , p .Name ())
142
+ return nil , fmt .Errorf ("score plugin %q is not configured with weight" , p .Name ())
143
143
}
144
144
f .scorePlugins = append (f .scorePlugins , p )
145
145
@@ -150,7 +150,7 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
150
150
f .scoreWithNormalizePlugins = append (f .scoreWithNormalizePlugins , np )
151
151
}
152
152
} else {
153
- return nil , fmt .Errorf ("score plugin %v does not exist" , sc .Name )
153
+ return nil , fmt .Errorf ("score plugin %q does not exist" , sc .Name )
154
154
}
155
155
}
156
156
}
@@ -160,11 +160,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
160
160
if pg , ok := pluginsMap [r .Name ]; ok {
161
161
p , ok := pg .(ReservePlugin )
162
162
if ! ok {
163
- return nil , fmt .Errorf ("plugin %v does not extend reserve plugin" , r .Name )
163
+ return nil , fmt .Errorf ("plugin %q does not extend reserve plugin" , r .Name )
164
164
}
165
165
f .reservePlugins = append (f .reservePlugins , p )
166
166
} else {
167
- return nil , fmt .Errorf ("reserve plugin %v does not exist" , r .Name )
167
+ return nil , fmt .Errorf ("reserve plugin %q does not exist" , r .Name )
168
168
}
169
169
}
170
170
}
@@ -174,11 +174,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
174
174
if pg , ok := pluginsMap [r .Name ]; ok {
175
175
p , ok := pg .(PostFilterPlugin )
176
176
if ! ok {
177
- return nil , fmt .Errorf ("plugin %v does not extend post-filter plugin" , r .Name )
177
+ return nil , fmt .Errorf ("plugin %q does not extend post-filter plugin" , r .Name )
178
178
}
179
179
f .postFilterPlugins = append (f .postFilterPlugins , p )
180
180
} else {
181
- return nil , fmt .Errorf ("post-filter plugin %v does not exist" , r .Name )
181
+ return nil , fmt .Errorf ("post-filter plugin %q does not exist" , r .Name )
182
182
}
183
183
}
184
184
}
@@ -188,11 +188,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
188
188
if pg , ok := pluginsMap [pb .Name ]; ok {
189
189
p , ok := pg .(PrebindPlugin )
190
190
if ! ok {
191
- return nil , fmt .Errorf ("plugin %v does not extend prebind plugin" , pb .Name )
191
+ return nil , fmt .Errorf ("plugin %q does not extend prebind plugin" , pb .Name )
192
192
}
193
193
f .prebindPlugins = append (f .prebindPlugins , p )
194
194
} else {
195
- return nil , fmt .Errorf ("prebind plugin %v does not exist" , pb .Name )
195
+ return nil , fmt .Errorf ("prebind plugin %q does not exist" , pb .Name )
196
196
}
197
197
}
198
198
}
@@ -202,11 +202,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
202
202
if pg , ok := pluginsMap [pb .Name ]; ok {
203
203
p , ok := pg .(BindPlugin )
204
204
if ! ok {
205
- return nil , fmt .Errorf ("plugin %v does not extend bind plugin" , pb .Name )
205
+ return nil , fmt .Errorf ("plugin %q does not extend bind plugin" , pb .Name )
206
206
}
207
207
f .bindPlugins = append (f .bindPlugins , p )
208
208
} else {
209
- return nil , fmt .Errorf ("bind plugin %v does not exist" , pb .Name )
209
+ return nil , fmt .Errorf ("bind plugin %q does not exist" , pb .Name )
210
210
}
211
211
}
212
212
}
@@ -216,11 +216,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
216
216
if pg , ok := pluginsMap [pb .Name ]; ok {
217
217
p , ok := pg .(PostbindPlugin )
218
218
if ! ok {
219
- return nil , fmt .Errorf ("plugin %v does not extend postbind plugin" , pb .Name )
219
+ return nil , fmt .Errorf ("plugin %q does not extend postbind plugin" , pb .Name )
220
220
}
221
221
f .postbindPlugins = append (f .postbindPlugins , p )
222
222
} else {
223
- return nil , fmt .Errorf ("postbind plugin %v does not exist" , pb .Name )
223
+ return nil , fmt .Errorf ("postbind plugin %q does not exist" , pb .Name )
224
224
}
225
225
}
226
226
}
@@ -230,11 +230,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
230
230
if pg , ok := pluginsMap [ur .Name ]; ok {
231
231
p , ok := pg .(UnreservePlugin )
232
232
if ! ok {
233
- return nil , fmt .Errorf ("plugin %v does not extend unreserve plugin" , ur .Name )
233
+ return nil , fmt .Errorf ("plugin %q does not extend unreserve plugin" , ur .Name )
234
234
}
235
235
f .unreservePlugins = append (f .unreservePlugins , p )
236
236
} else {
237
- return nil , fmt .Errorf ("unreserve plugin %v does not exist" , ur .Name )
237
+ return nil , fmt .Errorf ("unreserve plugin %q does not exist" , ur .Name )
238
238
}
239
239
}
240
240
}
@@ -244,11 +244,11 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
244
244
if pg , ok := pluginsMap [pr .Name ]; ok {
245
245
p , ok := pg .(PermitPlugin )
246
246
if ! ok {
247
- return nil , fmt .Errorf ("plugin %v does not extend permit plugin" , pr .Name )
247
+ return nil , fmt .Errorf ("plugin %q does not extend permit plugin" , pr .Name )
248
248
}
249
249
f .permitPlugins = append (f .permitPlugins , p )
250
250
} else {
251
- return nil , fmt .Errorf ("permit plugin %v does not exist" , pr .Name )
251
+ return nil , fmt .Errorf ("permit plugin %q does not exist" , pr .Name )
252
252
}
253
253
}
254
254
}
@@ -258,14 +258,14 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
258
258
if pg , ok := pluginsMap [qs .Name ]; ok {
259
259
p , ok := pg .(QueueSortPlugin )
260
260
if ! ok {
261
- return nil , fmt .Errorf ("plugin %v does not extend queue sort plugin" , qs .Name )
261
+ return nil , fmt .Errorf ("plugin %q does not extend queue sort plugin" , qs .Name )
262
262
}
263
263
f .queueSortPlugins = append (f .queueSortPlugins , p )
264
264
if len (f .queueSortPlugins ) > 1 {
265
265
return nil , fmt .Errorf ("only one queue sort plugin can be enabled" )
266
266
}
267
267
} else {
268
- return nil , fmt .Errorf ("queue sort plugin %v does not exist" , qs .Name )
268
+ return nil , fmt .Errorf ("queue sort plugin %q does not exist" , qs .Name )
269
269
}
270
270
}
271
271
}
@@ -293,11 +293,11 @@ func (f *framework) RunPrefilterPlugins(
293
293
status := pl .Prefilter (pc , pod )
294
294
if ! status .IsSuccess () {
295
295
if status .Code () == Unschedulable {
296
- msg := fmt .Sprintf ("rejected by %v at prefilter: %v" , pl .Name (), status .Message ())
296
+ msg := fmt .Sprintf ("rejected by %q at prefilter: %v" , pl .Name (), status .Message ())
297
297
klog .V (4 ).Infof (msg )
298
298
return NewStatus (status .Code (), msg )
299
299
}
300
- msg := fmt .Sprintf ("error while running %v prefilter plugin for pod %v : %v" , pl .Name (), pod .Name , status .Message ())
300
+ msg := fmt .Sprintf ("error while running %q prefilter plugin for pod %q : %v" , pl .Name (), pod .Name , status .Message ())
301
301
klog .Error (msg )
302
302
return NewStatus (Error , msg )
303
303
}
@@ -316,7 +316,7 @@ func (f *framework) RunFilterPlugins(pc *PluginContext,
316
316
status := pl .Filter (pc , pod , nodeName )
317
317
if ! status .IsSuccess () {
318
318
if status .Code () != Unschedulable {
319
- errMsg := fmt .Sprintf ("RunFilterPlugins: error while running %v filter plugin for pod %v : %v" ,
319
+ errMsg := fmt .Sprintf ("error while running %q filter plugin for pod %q : %v" ,
320
320
pl .Name (), pod .Name , status .Message ())
321
321
klog .Error (errMsg )
322
322
return NewStatus (Error , errMsg )
@@ -340,7 +340,7 @@ func (f *framework) RunPostFilterPlugins(
340
340
for _ , pl := range f .postFilterPlugins {
341
341
status := pl .PostFilter (pc , pod , nodes , filteredNodesStatuses )
342
342
if ! status .IsSuccess () {
343
- msg := fmt .Sprintf ("error while running %v postfilter plugin for pod %v : %v" , pl .Name (), pod .Name , status .Message ())
343
+ msg := fmt .Sprintf ("error while running %q postfilter plugin for pod %q : %v" , pl .Name (), pod .Name , status .Message ())
344
344
klog .Error (msg )
345
345
return NewStatus (Error , msg )
346
346
}
@@ -372,7 +372,7 @@ func (f *framework) RunScorePlugins(pc *PluginContext, pod *v1.Pod, nodes []*v1.
372
372
})
373
373
374
374
if err := errCh .ReceiveError (); err != nil {
375
- msg := fmt .Sprintf ("error while running score plugin for pod %v : %v" , pod .Name , err )
375
+ msg := fmt .Sprintf ("error while running score plugin for pod %q : %v" , pod .Name , err )
376
376
klog .Error (msg )
377
377
return nil , NewStatus (Error , msg )
378
378
}
@@ -391,20 +391,20 @@ func (f *framework) RunNormalizeScorePlugins(pc *PluginContext, pod *v1.Pod, sco
391
391
pl := f .scoreWithNormalizePlugins [index ]
392
392
nodeScoreList , ok := scores [pl .Name ()]
393
393
if ! ok {
394
- err := fmt .Errorf ("normalize score plugin %v has no corresponding scores in the PluginToNodeScoreMap" , pl .Name ())
394
+ err := fmt .Errorf ("normalize score plugin %q has no corresponding scores in the PluginToNodeScoreMap" , pl .Name ())
395
395
errCh .SendErrorWithCancel (err , cancel )
396
396
return
397
397
}
398
398
status := pl .NormalizeScore (pc , pod , nodeScoreList )
399
399
if ! status .IsSuccess () {
400
- err := fmt .Errorf ("normalize score plugin %v failed with error %v" , pl .Name (), status .Message ())
400
+ err := fmt .Errorf ("normalize score plugin %q failed with error %v" , pl .Name (), status .Message ())
401
401
errCh .SendErrorWithCancel (err , cancel )
402
402
return
403
403
}
404
404
})
405
405
406
406
if err := errCh .ReceiveError (); err != nil {
407
- msg := fmt .Sprintf ("error while running normalize score plugin for pod %v : %v" , pod .Name , err )
407
+ msg := fmt .Sprintf ("error while running normalize score plugin for pod %q : %v" , pod .Name , err )
408
408
klog .Error (msg )
409
409
return NewStatus (Error , msg )
410
410
}
@@ -423,7 +423,7 @@ func (f *framework) ApplyScoreWeights(pc *PluginContext, pod *v1.Pod, scores Plu
423
423
weight := f .pluginNameToWeightMap [pl .Name ()]
424
424
nodeScoreList , ok := scores [pl .Name ()]
425
425
if ! ok {
426
- err := fmt .Errorf ("score plugin %v has no corresponding scores in the PluginToNodeScoreMap" , pl .Name ())
426
+ err := fmt .Errorf ("score plugin %q has no corresponding scores in the PluginToNodeScoreMap" , pl .Name ())
427
427
errCh .SendErrorWithCancel (err , cancel )
428
428
return
429
429
}
@@ -433,7 +433,7 @@ func (f *framework) ApplyScoreWeights(pc *PluginContext, pod *v1.Pod, scores Plu
433
433
})
434
434
435
435
if err := errCh .ReceiveError (); err != nil {
436
- msg := fmt .Sprintf ("error while applying score weights for pod %v : %v" , pod .Name , err )
436
+ msg := fmt .Sprintf ("error while applying score weights for pod %q : %v" , pod .Name , err )
437
437
klog .Error (msg )
438
438
return NewStatus (Error , msg )
439
439
}
@@ -450,11 +450,11 @@ func (f *framework) RunPrebindPlugins(
450
450
status := pl .Prebind (pc , pod , nodeName )
451
451
if ! status .IsSuccess () {
452
452
if status .Code () == Unschedulable {
453
- msg := fmt .Sprintf ("rejected by %v at prebind: %v" , pl .Name (), status .Message ())
453
+ msg := fmt .Sprintf ("rejected by %q at prebind: %v" , pl .Name (), status .Message ())
454
454
klog .V (4 ).Infof (msg )
455
455
return NewStatus (status .Code (), msg )
456
456
}
457
- msg := fmt .Sprintf ("error while running %v prebind plugin for pod %v : %v" , pl .Name (), pod .Name , status .Message ())
457
+ msg := fmt .Sprintf ("error while running %q prebind plugin for pod %q : %v" , pl .Name (), pod .Name , status .Message ())
458
458
klog .Error (msg )
459
459
return NewStatus (Error , msg )
460
460
}
@@ -474,7 +474,7 @@ func (f *framework) RunBindPlugins(pc *PluginContext, pod *v1.Pod, nodeName stri
474
474
continue
475
475
}
476
476
if ! status .IsSuccess () {
477
- msg := fmt .Sprintf ("bind plugin %v failed to bind pod %v/%v: %v" , bp .Name (), pod .Namespace , pod .Name , status .Message ())
477
+ msg := fmt .Sprintf ("bind plugin %q failed to bind pod \" %v/%v\" : %v" , bp .Name (), pod .Namespace , pod .Name , status .Message ())
478
478
klog .Error (msg )
479
479
return NewStatus (Error , msg )
480
480
}
@@ -499,7 +499,7 @@ func (f *framework) RunReservePlugins(
499
499
for _ , pl := range f .reservePlugins {
500
500
status := pl .Reserve (pc , pod , nodeName )
501
501
if ! status .IsSuccess () {
502
- msg := fmt .Sprintf ("error while running %v reserve plugin for pod %v : %v" , pl .Name (), pod .Name , status .Message ())
502
+ msg := fmt .Sprintf ("error while running %q reserve plugin for pod %q : %v" , pl .Name (), pod .Name , status .Message ())
503
503
klog .Error (msg )
504
504
return NewStatus (Error , msg )
505
505
}
@@ -530,7 +530,7 @@ func (f *framework) RunPermitPlugins(
530
530
status , d := pl .Permit (pc , pod , nodeName )
531
531
if ! status .IsSuccess () {
532
532
if status .Code () == Unschedulable {
533
- msg := fmt .Sprintf ("rejected by %v at permit: %v" , pl .Name (), status .Message ())
533
+ msg := fmt .Sprintf ("rejected by %q at permit: %v" , pl .Name (), status .Message ())
534
534
klog .V (4 ).Infof (msg )
535
535
return NewStatus (status .Code (), msg )
536
536
}
@@ -541,7 +541,7 @@ func (f *framework) RunPermitPlugins(
541
541
}
542
542
statusCode = Wait
543
543
} else {
544
- msg := fmt .Sprintf ("error while running %v permit plugin for pod %v : %v" , pl .Name (), pod .Name , status .Message ())
544
+ msg := fmt .Sprintf ("error while running %q permit plugin for pod %q : %v" , pl .Name (), pod .Name , status .Message ())
545
545
klog .Error (msg )
546
546
return NewStatus (Error , msg )
547
547
}
@@ -555,10 +555,10 @@ func (f *framework) RunPermitPlugins(
555
555
f .waitingPods .add (w )
556
556
defer f .waitingPods .remove (pod .UID )
557
557
timer := time .NewTimer (timeout )
558
- klog .V (4 ).Infof ("waiting for %v for pod %v at permit" , timeout , pod .Name )
558
+ klog .V (4 ).Infof ("waiting for %v for pod %q at permit" , timeout , pod .Name )
559
559
select {
560
560
case <- timer .C :
561
- msg := fmt .Sprintf ("pod %v rejected due to timeout after waiting %v at permit" , pod .Name , timeout )
561
+ msg := fmt .Sprintf ("pod %q rejected due to timeout after waiting %v at permit" , pod .Name , timeout )
562
562
klog .V (4 ).Infof (msg )
563
563
return NewStatus (Unschedulable , msg )
564
564
case s := <- w .s :
@@ -568,7 +568,7 @@ func (f *framework) RunPermitPlugins(
568
568
klog .V (4 ).Infof (msg )
569
569
return NewStatus (s .Code (), msg )
570
570
}
571
- msg := fmt .Sprintf ("error received while waiting at permit for pod %v : %v" , pod .Name , s .Message ())
571
+ msg := fmt .Sprintf ("error received while waiting at permit for pod %q : %v" , pod .Name , s .Message ())
572
572
klog .Error (msg )
573
573
return NewStatus (Error , msg )
574
574
}
0 commit comments