@@ -109,7 +109,7 @@ type controller struct {
109109 mu sync.Mutex
110110 notifyMap map [string ]* stringSet
111111 cleanupMap map [string ]* stringSet
112- workqueue workqueue.RateLimitingInterface
112+ workqueue workqueue.TypedRateLimitingInterface [ any ]
113113 gk schema.GroupKind
114114 metrics * metricsManager
115115 recorder record.EventRecorder
@@ -156,6 +156,9 @@ type VolumePopulatorConfig struct {
156156 // status code of 1. Specify this channel when an external process needs to manage the controller's life-cycle (i.e. a process needs
157157 // to manually close the stop channel).
158158 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 ]
159162}
160163
161164type PodConfig struct {
@@ -283,6 +286,13 @@ func RunControllerWithConfig(vpcfg VolumePopulatorConfig) {
283286 klog .Fatalf ("PodConfig and ProviderFunctionConfig can't be provided at the same time" )
284287 }
285288
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+
286296 c := & controller {
287297 kubeClient : kubeClient ,
288298 populatorNamespace : vpcfg .Namespace ,
@@ -300,7 +310,7 @@ func RunControllerWithConfig(vpcfg VolumePopulatorConfig) {
300310 unstSynced : unstInformer .HasSynced ,
301311 notifyMap : make (map [string ]* stringSet ),
302312 cleanupMap : make (map [string ]* stringSet ),
303- workqueue : workqueue . NewRateLimitingQueue ( workqueue . DefaultControllerRateLimiter ()) ,
313+ workqueue : wq ,
304314 gk : vpcfg .Gk ,
305315 metrics : initMetrics (),
306316 recorder : getRecorder (kubeClient , vpcfg .Prefix + "-" + controllerNameSuffix ),
0 commit comments