@@ -109,7 +109,7 @@ type controller struct {
109
109
mu sync.Mutex
110
110
notifyMap map [string ]* stringSet
111
111
cleanupMap map [string ]* stringSet
112
- workqueue workqueue.RateLimitingInterface
112
+ workqueue workqueue.TypedRateLimitingInterface [ any ]
113
113
gk schema.GroupKind
114
114
metrics * metricsManager
115
115
recorder record.EventRecorder
@@ -156,6 +156,9 @@ type VolumePopulatorConfig struct {
156
156
// status code of 1. Specify this channel when an external process needs to manage the controller's life-cycle (i.e. a process needs
157
157
// to manually close the stop channel).
158
158
StopCh chan struct {}
159
+ // Workqueue stores the work items to be processd by the volume populator. You can provide a custom workqueue;
160
+ // otherwise, a default workqueue is used
161
+ Workqueue workqueue.TypedRateLimitingInterface [any ]
159
162
}
160
163
161
164
type PodConfig struct {
@@ -283,6 +286,13 @@ func RunControllerWithConfig(vpcfg VolumePopulatorConfig) {
283
286
klog .Fatalf ("PodConfig and ProviderFunctionConfig can't be provided at the same time" )
284
287
}
285
288
289
+ var wq workqueue.TypedRateLimitingInterface [any ]
290
+ if vpcfg .Workqueue == nil {
291
+ wq = workqueue .NewTypedRateLimitingQueue (workqueue .DefaultTypedControllerRateLimiter [any ]())
292
+ } else {
293
+ wq = vpcfg .Workqueue
294
+ }
295
+
286
296
c := & controller {
287
297
kubeClient : kubeClient ,
288
298
populatorNamespace : vpcfg .Namespace ,
@@ -300,7 +310,7 @@ func RunControllerWithConfig(vpcfg VolumePopulatorConfig) {
300
310
unstSynced : unstInformer .HasSynced ,
301
311
notifyMap : make (map [string ]* stringSet ),
302
312
cleanupMap : make (map [string ]* stringSet ),
303
- workqueue : workqueue . NewRateLimitingQueue ( workqueue . DefaultControllerRateLimiter ()) ,
313
+ workqueue : wq ,
304
314
gk : vpcfg .Gk ,
305
315
metrics : initMetrics (),
306
316
recorder : getRecorder (kubeClient , vpcfg .Prefix + "-" + controllerNameSuffix ),
0 commit comments