@@ -69,6 +69,7 @@ func (d *stateData) Clone() framework.StateData {
69
69
type VolumeBinding struct {
70
70
Binder scheduling.SchedulerVolumeBinder
71
71
PVCLister corelisters.PersistentVolumeClaimLister
72
+ NodeLister corelisters.NodeLister
72
73
frameworkHandler framework.Handle
73
74
}
74
75
@@ -232,6 +233,15 @@ func (pl *VolumeBinding) Filter(_ context.Context, cs *framework.CycleState, pod
232
233
233
234
// Reserve reserves volumes of pod and saves binding status in cycle state.
234
235
func (pl * VolumeBinding ) Reserve (_ context.Context , cs * framework.CycleState , pod * corev1.Pod , nodeName string ) * framework.Status {
236
+ node , err := pl .NodeLister .Get (nodeName )
237
+ if err == nil {
238
+ return framework .NewStatus (framework .Error , "node not found" )
239
+ }
240
+
241
+ if helpers .HasKnodeTaint (node ) {
242
+ return nil
243
+ }
244
+
235
245
state , err := getStateData (cs )
236
246
if err != nil {
237
247
return framework .AsStatus (err )
@@ -257,6 +267,15 @@ func (pl *VolumeBinding) Reserve(_ context.Context, cs *framework.CycleState, po
257
267
// If binding errors, times out or gets undone, then an error will be returned to
258
268
// retry scheduling.
259
269
func (pl * VolumeBinding ) PreBind (ctx context.Context , cs * framework.CycleState , pod * corev1.Pod , nodeName string ) * framework.Status {
270
+ node , err := pl .NodeLister .Get (nodeName )
271
+ if err == nil {
272
+ return framework .NewStatus (framework .Error , "node not found" )
273
+ }
274
+
275
+ if helpers .HasKnodeTaint (node ) {
276
+ return nil
277
+ }
278
+
260
279
s , err := getStateData (cs )
261
280
if err != nil {
262
281
return framework .AsStatus (err )
@@ -283,6 +302,15 @@ func (pl *VolumeBinding) PreBind(ctx context.Context, cs *framework.CycleState,
283
302
// Unreserve clears assumed PV and PVC cache.
284
303
// It's idempotent, and does nothing if no cache found for the given pod.
285
304
func (pl * VolumeBinding ) Unreserve (_ context.Context , cs * framework.CycleState , _ * corev1.Pod , nodeName string ) {
305
+ node , err := pl .NodeLister .Get (nodeName )
306
+ if err != nil {
307
+ return
308
+ }
309
+
310
+ if helpers .HasKnodeTaint (node ) {
311
+ return
312
+ }
313
+
286
314
s , err := getStateData (cs )
287
315
if err != nil {
288
316
return
@@ -317,6 +345,7 @@ func New(plArgs runtime.Object, fh framework.Handle) (framework.Plugin, error) {
317
345
return & VolumeBinding {
318
346
Binder : binder ,
319
347
PVCLister : pvcInformer .Lister (),
348
+ NodeLister : nodeInformer .Lister (),
320
349
frameworkHandler : fh ,
321
350
}, nil
322
351
}
0 commit comments