@@ -61,6 +61,8 @@ type modifyController struct {
61
61
extraModifyMetadata bool
62
62
// the key of the map is {PVC_NAMESPACE}/{PVC_NAME}
63
63
uncertainPVCs map [string ]v1.PersistentVolumeClaim
64
+ // slowSet tracks PVCs for which modification failed with infeasible error and should be retried at slower rate.
65
+ slowSet * util.SlowSet
64
66
}
65
67
66
68
// NewModifyController returns a ModifyController.
@@ -69,6 +71,7 @@ func NewModifyController(
69
71
modifier modifier.Modifier ,
70
72
kubeClient kubernetes.Interface ,
71
73
resyncPeriod time.Duration ,
74
+ maxRetryInterval time.Duration ,
72
75
extraModifyMetadata bool ,
73
76
informerFactory informers.SharedInformerFactory ,
74
77
pvcRateLimiter workqueue.TypedRateLimiter [string ]) ModifyController {
@@ -99,8 +102,9 @@ func NewModifyController(
99
102
claimQueue : claimQueue ,
100
103
eventRecorder : eventRecorder ,
101
104
extraModifyMetadata : extraModifyMetadata ,
105
+ slowSet : util .NewSlowSet (maxRetryInterval ),
102
106
}
103
- // Add a resync period as the PVC's request modify can be modified again when we handling
107
+ // Add a resync period as the PVC's request modify can be modified again when we are handling
104
108
// a previous modify request of the same PVC.
105
109
pvcInformer .Informer ().AddEventHandlerWithResyncPeriod (cache.ResourceEventHandlerFuncs {
106
110
AddFunc : ctrl .addPVC ,
@@ -211,6 +215,10 @@ func (ctrl *modifyController) Run(
211
215
}
212
216
213
217
stopCh := ctx .Done ()
218
+
219
+ // Starts go-routine that deletes expired slowSet entries.
220
+ go ctrl .slowSet .Run (stopCh )
221
+
214
222
for i := 0 ; i < workers ; i ++ {
215
223
go wait .Until (ctrl .sync , 0 , stopCh )
216
224
}
@@ -235,7 +243,7 @@ func (ctrl *modifyController) sync() {
235
243
}
236
244
}
237
245
238
- // syncPVC checks if a pvc requests resizing , and execute the resize operation if requested.
246
+ // syncPVC checks if a pvc requests modification , and execute the ModifyVolume operation if requested.
239
247
func (ctrl * modifyController ) syncPVC (key string ) error {
240
248
klog .V (4 ).InfoS ("Started PVC processing for modify controller" , "key" , key )
241
249
@@ -260,7 +268,7 @@ func (ctrl *modifyController) syncPVC(key string) error {
260
268
}
261
269
262
270
// Only trigger modify volume if the following conditions are met
263
- // 1. Non empty vac name
271
+ // 1. Non- empty vac name
264
272
// 2. PVC is in Bound state
265
273
// 3. PV CSI driver name matches local driver
266
274
vacName := pvc .Spec .VolumeAttributesClassName
0 commit comments