diff --git a/examples/workqueue/main.go b/examples/workqueue/main.go index e854840a..b8825dc1 100644 --- a/examples/workqueue/main.go +++ b/examples/workqueue/main.go @@ -37,12 +37,12 @@ import ( // Controller demonstrates how to implement a controller with client-go. type Controller struct { indexer cache.Indexer - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] informer cache.Controller } // NewController creates a new Controller. -func NewController(queue workqueue.RateLimitingInterface, indexer cache.Indexer, informer cache.Controller) *Controller { +func NewController(queue workqueue.TypedRateLimitingInterface[string], indexer cache.Indexer, informer cache.Controller) *Controller { return &Controller{ informer: informer, indexer: indexer, @@ -62,7 +62,7 @@ func (c *Controller) processNextItem() bool { defer c.queue.Done(key) // Invoke the method containing the business logic - err := c.syncToStdout(key.(string)) + err := c.syncToStdout(key) // Handle the error if something went wrong during the execution of the business logic c.handleErr(err, key) return true @@ -90,7 +90,7 @@ func (c *Controller) syncToStdout(key string) error { } // handleErr checks if an error happened and makes sure we will retry later. -func (c *Controller) handleErr(err error, key interface{}) { +func (c *Controller) handleErr(err error, key string) { if err == nil { // Forget about the #AddRateLimited history of the key on every successful synchronization. // This ensures that future processing of updates for this key is not delayed because of @@ -168,7 +168,7 @@ func main() { podListWatcher := cache.NewListWatchFromClient(clientset.CoreV1().RESTClient(), "pods", v1.NamespaceDefault, fields.Everything()) // create the workqueue - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[string]()) // Bind the workqueue to a cache with the help of an informer. This way we make sure that // whenever the cache is updated, the pod key is added to the workqueue. diff --git a/transport/cert_rotation.go b/transport/cert_rotation.go index dc22b6ec..e76f6581 100644 --- a/transport/cert_rotation.go +++ b/transport/cert_rotation.go @@ -47,14 +47,17 @@ type dynamicClientCert struct { connDialer *connrotation.Dialer // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] } func certRotatingDialer(reload reloadFunc, dial utilnet.DialFunc) *dynamicClientCert { d := &dynamicClientCert{ reload: reload, connDialer: connrotation.NewDialer(connrotation.DialFunc(dial)), - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "DynamicClientCertificate"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.DefaultTypedControllerRateLimiter[string](), + workqueue.TypedRateLimitingQueueConfig[string]{Name: "DynamicClientCertificate"}, + ), } return d