Split out rate limiter per workqueue
If you share a ratelimiter between workqueues, it breaks. WQ1: Starts processing item (When) WQ1: Fails to process item (When) WQ1: Fails to process item (When) WQ1: Fails to process item (When) --- At this point we've backed off a bit --- WQ2: Starts processing item (with same key, When) WQ2: Succeeds at processing item (Forget) WQ1: Fails to process item (When) ---> THIS RESULTS IN AN ERROR This results in an error because it "forgot" the previous rate limit.
This commit is contained in:
@@ -44,11 +44,6 @@ func newTestController() *TestController {
|
||||
rm := testutil.FakeResourceManager()
|
||||
p := newMockProvider()
|
||||
iFactory := kubeinformers.NewSharedInformerFactoryWithOptions(fk8s, 10*time.Minute)
|
||||
rateLimiter := workqueue.NewMaxOfRateLimiter(
|
||||
// The default upper bound is 1000 seconds. Let's not use that.
|
||||
workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, 10*time.Millisecond),
|
||||
&workqueue.BucketRateLimiter{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
|
||||
)
|
||||
podController, err := NewPodController(PodControllerConfig{
|
||||
PodClient: fk8s.CoreV1(),
|
||||
PodInformer: iFactory.Core().V1().Pods(),
|
||||
@@ -57,7 +52,21 @@ func newTestController() *TestController {
|
||||
ConfigMapInformer: iFactory.Core().V1().ConfigMaps(),
|
||||
SecretInformer: iFactory.Core().V1().Secrets(),
|
||||
ServiceInformer: iFactory.Core().V1().Services(),
|
||||
RateLimiter: rateLimiter,
|
||||
SyncPodsFromKubernetesRateLimiter: workqueue.NewMaxOfRateLimiter(
|
||||
// The default upper bound is 1000 seconds. Let's not use that.
|
||||
workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, 10*time.Millisecond),
|
||||
&workqueue.BucketRateLimiter{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
|
||||
),
|
||||
SyncPodStatusFromProviderRateLimiter: workqueue.NewMaxOfRateLimiter(
|
||||
// The default upper bound is 1000 seconds. Let's not use that.
|
||||
workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, 10*time.Millisecond),
|
||||
&workqueue.BucketRateLimiter{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
|
||||
),
|
||||
DeletePodsFromKubernetesRateLimiter: workqueue.NewMaxOfRateLimiter(
|
||||
// The default upper bound is 1000 seconds. Let's not use that.
|
||||
workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, 10*time.Millisecond),
|
||||
&workqueue.BucketRateLimiter{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
|
||||
),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user