diff --git a/pkg/config/resolver.go b/pkg/config/resolver.go index e7068ea7..6cd90ebf 100644 --- a/pkg/config/resolver.go +++ b/pkg/config/resolver.go @@ -222,7 +222,7 @@ func (r *Resolver) Queue() (*kubernetes.Queue, error) { return kubernetes.NewQueue( kubernetes.NewDebouncer(1*time.Minute, r.EventPublisher()), - workqueue.NewRateLimitingQueueWithConfig(workqueue.DefaultControllerRateLimiter(), workqueue.RateLimitingQueueConfig{ + workqueue.NewTypedRateLimitingQueueWithConfig(workqueue.DefaultTypedControllerRateLimiter[string](), workqueue.TypedRateLimitingQueueConfig[string]{ Name: "report-queue", }), client, diff --git a/pkg/kubernetes/policy_report_client_test.go b/pkg/kubernetes/policy_report_client_test.go index cb441bcb..4bde24eb 100644 --- a/pkg/kubernetes/policy_report_client_test.go +++ b/pkg/kubernetes/policy_report_client_test.go @@ -37,7 +37,7 @@ func Test_PolicyReportWatcher(t *testing.T) { queue := kubernetes.NewQueue( kubernetes.NewDebouncer(0, publisher), - workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "test-queue"), + workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[string]()), restClient.Wgpolicyk8sV1alpha2(), report.NewSourceFilter(nil, nil, []report.SourceValidation{}), result.NewReconditioner(nil), @@ -89,7 +89,7 @@ func Test_ClusterPolicyReportWatcher(t *testing.T) { queue := kubernetes.NewQueue( kubernetes.NewDebouncer(0, publisher), - workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "test-queue"), + workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[string]()), restClient.Wgpolicyk8sV1alpha2(), report.NewSourceFilter(nil, nil, []report.SourceValidation{}), result.NewReconditioner(nil), @@ -131,7 +131,7 @@ func Test_HasSynced(t *testing.T) { queue := kubernetes.NewQueue( kubernetes.NewDebouncer(0, report.NewEventPublisher()), - workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "test-queue"), + workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[string]()), restClient.Wgpolicyk8sV1alpha2(), report.NewSourceFilter(nil, nil, []report.SourceValidation{}), result.NewReconditioner(nil), diff --git a/pkg/kubernetes/queue.go b/pkg/kubernetes/queue.go index b20fbb55..fdd62235 100644 --- a/pkg/kubernetes/queue.go +++ b/pkg/kubernetes/queue.go @@ -21,7 +21,7 @@ import ( ) type Queue struct { - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] client v1alpha2.Wgpolicyk8sV1alpha2Interface reconditioner *result.Reconditioner debouncer Debouncer @@ -57,11 +57,10 @@ func (q *Queue) runWorker() { } func (q *Queue) processNextItem() bool { - obj, quit := q.queue.Get() + key, quit := q.queue.Get() if quit { return false } - key := obj.(string) defer q.queue.Done(key) namespace, name, err := cache.SplitMetaNamespaceKey(key) @@ -127,7 +126,7 @@ func (q *Queue) processNextItem() bool { return true } -func (q *Queue) handleErr(err error, key interface{}) { +func (q *Queue) handleErr(err error, key string) { if err == nil { q.queue.Forget(key) return @@ -148,7 +147,7 @@ func (q *Queue) handleErr(err error, key interface{}) { func NewQueue( debouncer Debouncer, - queue workqueue.RateLimitingInterface, + queue workqueue.TypedRateLimitingInterface[string], client v1alpha2.Wgpolicyk8sV1alpha2Interface, filter *report.SourceFilter, reconditioner *result.Reconditioner,