@@ -317,7 +317,7 @@ func testGetListCacheBypass(t *testing.T, options storage.ListOptions, expectByp
317
317
t .Fatalf ("Couldn't create cacher: %v" , err )
318
318
}
319
319
defer cacher .Stop ()
320
- proxy := NewCacheProxy (cacher , backingStorage )
320
+ delegator := NewCacheDelegator (cacher , backingStorage )
321
321
result := & example.PodList {}
322
322
if ! utilfeature .DefaultFeatureGate .Enabled (features .ResilientWatchCacheInitialization ) {
323
323
if err := cacher .ready .wait (context .Background ()); err != nil {
@@ -342,7 +342,7 @@ func testGetListCacheBypass(t *testing.T, options storage.ListOptions, expectByp
342
342
return nil
343
343
}
344
344
}
345
- err = proxy .GetList (context .TODO (), "pods/ns" , options , result )
345
+ err = delegator .GetList (context .TODO (), "pods/ns" , options , result )
346
346
gotBypass := errors .Is (err , errDummy )
347
347
if err != nil && ! gotBypass {
348
348
t .Fatalf ("Unexpected error for List request with options: %v, err: %v" , options , err )
@@ -441,7 +441,7 @@ apiserver_watch_cache_consistent_read_total{fallback="true", resource="pods", su
441
441
t .Fatalf ("Couldn't create cacher: %v" , err )
442
442
}
443
443
defer cacher .Stop ()
444
- proxy := NewCacheProxy (cacher , backingStorage )
444
+ delegator := NewCacheDelegator (cacher , backingStorage )
445
445
if err := cacher .ready .wait (context .Background ()); err != nil {
446
446
t .Fatalf ("unexpected error waiting for the cache to be ready" )
447
447
}
@@ -484,7 +484,7 @@ apiserver_watch_cache_consistent_read_total{fallback="true", resource="pods", su
484
484
}
485
485
486
486
start := cacher .clock .Now ()
487
- err = proxy .GetList (context .TODO (), "pods/ns" , storage.ListOptions {ResourceVersion : "" }, result )
487
+ err = delegator .GetList (context .TODO (), "pods/ns" , storage.ListOptions {ResourceVersion : "" }, result )
488
488
clockStepCancelFn ()
489
489
duration := cacher .clock .Since (start )
490
490
if (err != nil ) != tc .expectError {
@@ -516,7 +516,7 @@ func TestGetListNonRecursiveCacheBypass(t *testing.T) {
516
516
t .Fatalf ("Couldn't create cacher: %v" , err )
517
517
}
518
518
defer cacher .Stop ()
519
- proxy := NewCacheProxy (cacher , backingStorage )
519
+ delegator := NewCacheDelegator (cacher , backingStorage )
520
520
521
521
pred := storage.SelectionPredicate {
522
522
Limit : 500 ,
@@ -531,15 +531,15 @@ func TestGetListNonRecursiveCacheBypass(t *testing.T) {
531
531
532
532
// Inject error to underlying layer and check if cacher is not bypassed.
533
533
backingStorage .injectError (errDummy )
534
- err = proxy .GetList (context .TODO (), "pods/ns" , storage.ListOptions {
534
+ err = delegator .GetList (context .TODO (), "pods/ns" , storage.ListOptions {
535
535
ResourceVersion : "0" ,
536
536
Predicate : pred ,
537
537
}, result )
538
538
if err != nil {
539
539
t .Errorf ("GetList with Limit and RV=0 should be served from cache: %v" , err )
540
540
}
541
541
542
- err = proxy .GetList (context .TODO (), "pods/ns" , storage.ListOptions {
542
+ err = delegator .GetList (context .TODO (), "pods/ns" , storage.ListOptions {
543
543
ResourceVersion : "" ,
544
544
Predicate : pred ,
545
545
}, result )
@@ -555,7 +555,7 @@ func TestGetCacheBypass(t *testing.T) {
555
555
t .Fatalf ("Couldn't create cacher: %v" , err )
556
556
}
557
557
defer cacher .Stop ()
558
- proxy := NewCacheProxy (cacher , backingStorage )
558
+ delegator := NewCacheDelegator (cacher , backingStorage )
559
559
560
560
result := & example.Pod {}
561
561
@@ -567,15 +567,15 @@ func TestGetCacheBypass(t *testing.T) {
567
567
568
568
// Inject error to underlying layer and check if cacher is not bypassed.
569
569
backingStorage .injectError (errDummy )
570
- err = proxy .Get (context .TODO (), "pods/ns/pod-0" , storage.GetOptions {
570
+ err = delegator .Get (context .TODO (), "pods/ns/pod-0" , storage.GetOptions {
571
571
IgnoreNotFound : true ,
572
572
ResourceVersion : "0" ,
573
573
}, result )
574
574
if err != nil {
575
575
t .Errorf ("Get with RV=0 should be served from cache: %v" , err )
576
576
}
577
577
578
- err = proxy .Get (context .TODO (), "pods/ns/pod-0" , storage.GetOptions {
578
+ err = delegator .Get (context .TODO (), "pods/ns/pod-0" , storage.GetOptions {
579
579
IgnoreNotFound : true ,
580
580
ResourceVersion : "" ,
581
581
}, result )
@@ -591,23 +591,23 @@ func TestWatchCacheBypass(t *testing.T) {
591
591
t .Fatalf ("Couldn't create cacher: %v" , err )
592
592
}
593
593
defer cacher .Stop ()
594
- proxy := NewCacheProxy (cacher , backingStorage )
594
+ delegator := NewCacheDelegator (cacher , backingStorage )
595
595
596
596
if ! utilfeature .DefaultFeatureGate .Enabled (features .ResilientWatchCacheInitialization ) {
597
597
if err := cacher .ready .wait (context .Background ()); err != nil {
598
598
t .Fatalf ("unexpected error waiting for the cache to be ready" )
599
599
}
600
600
}
601
601
602
- _ , err = proxy .Watch (context .TODO (), "pod/ns" , storage.ListOptions {
602
+ _ , err = delegator .Watch (context .TODO (), "pod/ns" , storage.ListOptions {
603
603
ResourceVersion : "0" ,
604
604
Predicate : storage .Everything ,
605
605
})
606
606
if err != nil {
607
607
t .Errorf ("Watch with RV=0 should be served from cache: %v" , err )
608
608
}
609
609
610
- _ , err = proxy .Watch (context .TODO (), "pod/ns" , storage.ListOptions {
610
+ _ , err = delegator .Watch (context .TODO (), "pod/ns" , storage.ListOptions {
611
611
ResourceVersion : "" ,
612
612
Predicate : storage .Everything ,
613
613
})
@@ -628,7 +628,7 @@ func TestTooManyRequestsNotReturned(t *testing.T) {
628
628
t .Fatalf ("Couldn't create cacher: %v" , err )
629
629
}
630
630
defer cacher .Stop ()
631
- proxy := NewCacheProxy (cacher , backingStorage )
631
+ delegator := NewCacheDelegator (cacher , backingStorage )
632
632
633
633
opts := storage.ListOptions {
634
634
ResourceVersion : "0" ,
@@ -640,15 +640,15 @@ func TestTooManyRequestsNotReturned(t *testing.T) {
640
640
defer listCancel ()
641
641
642
642
result := & example.PodList {}
643
- err = proxy .GetList (listCtx , "/pods/ns" , opts , result )
643
+ err = delegator .GetList (listCtx , "/pods/ns" , opts , result )
644
644
if err != nil && apierrors .IsTooManyRequests (err ) {
645
645
t .Errorf ("Unexpected 429 error without ResilientWatchCacheInitialization feature for List" )
646
646
}
647
647
648
648
watchCtx , watchCancel := context .WithTimeout (context .Background (), 250 * time .Millisecond )
649
649
defer watchCancel ()
650
650
651
- _ , err = proxy .Watch (watchCtx , "/pods/ns" , opts )
651
+ _ , err = delegator .Watch (watchCtx , "/pods/ns" , opts )
652
652
if err != nil && apierrors .IsTooManyRequests (err ) {
653
653
t .Errorf ("Unexpected 429 error without ResilientWatchCacheInitialization feature for Watch" )
654
654
}
@@ -873,15 +873,15 @@ func TestCacherDontAcceptRequestsStopped(t *testing.T) {
873
873
if err != nil {
874
874
t .Fatalf ("Couldn't create cacher: %v" , err )
875
875
}
876
- proxy := NewCacheProxy (cacher , backingStorage )
876
+ delegator := NewCacheDelegator (cacher , backingStorage )
877
877
878
878
if ! utilfeature .DefaultFeatureGate .Enabled (features .ResilientWatchCacheInitialization ) {
879
879
if err := cacher .ready .wait (context .Background ()); err != nil {
880
880
t .Fatalf ("unexpected error waiting for the cache to be ready" )
881
881
}
882
882
}
883
883
884
- w , err := proxy .Watch (context .Background (), "pods/ns" , storage.ListOptions {ResourceVersion : "0" , Predicate : storage .Everything })
884
+ w , err := delegator .Watch (context .Background (), "pods/ns" , storage.ListOptions {ResourceVersion : "0" , Predicate : storage .Everything })
885
885
if err != nil {
886
886
t .Fatalf ("Failed to create watch: %v" , err )
887
887
}
@@ -901,13 +901,13 @@ func TestCacherDontAcceptRequestsStopped(t *testing.T) {
901
901
902
902
cacher .Stop ()
903
903
904
- _ , err = proxy .Watch (context .Background (), "pods/ns" , storage.ListOptions {ResourceVersion : "0" , Predicate : storage .Everything })
904
+ _ , err = delegator .Watch (context .Background (), "pods/ns" , storage.ListOptions {ResourceVersion : "0" , Predicate : storage .Everything })
905
905
if err == nil {
906
906
t .Fatalf ("Success to create Watch: %v" , err )
907
907
}
908
908
909
909
result := & example.Pod {}
910
- err = proxy .Get (context .TODO (), "pods/ns/pod-0" , storage.GetOptions {
910
+ err = delegator .Get (context .TODO (), "pods/ns/pod-0" , storage.GetOptions {
911
911
IgnoreNotFound : true ,
912
912
ResourceVersion : "1" ,
913
913
}, result )
@@ -922,7 +922,7 @@ func TestCacherDontAcceptRequestsStopped(t *testing.T) {
922
922
}
923
923
924
924
listResult := & example.PodList {}
925
- err = proxy .GetList (context .TODO (), "pods/ns" , storage.ListOptions {
925
+ err = delegator .GetList (context .TODO (), "pods/ns" , storage.ListOptions {
926
926
ResourceVersion : "1" ,
927
927
Recursive : true ,
928
928
Predicate : storage.SelectionPredicate {
@@ -2291,7 +2291,7 @@ func BenchmarkCacher_GetList(b *testing.B) {
2291
2291
b .Fatalf ("new cacher: %v" , err )
2292
2292
}
2293
2293
defer cacher .Stop ()
2294
- proxy := NewCacheProxy (cacher , store )
2294
+ delegator := NewCacheDelegator (cacher , store )
2295
2295
2296
2296
// prepare result and pred
2297
2297
parsedField , err := fields .ParseSelector ("spec.nodeName=node-0" )
@@ -2307,7 +2307,7 @@ func BenchmarkCacher_GetList(b *testing.B) {
2307
2307
b .ResetTimer ()
2308
2308
for i := 0 ; i < b .N ; i ++ {
2309
2309
result := & example.PodList {}
2310
- err = proxy .GetList (context .TODO (), "pods" , storage.ListOptions {
2310
+ err = delegator .GetList (context .TODO (), "pods" , storage.ListOptions {
2311
2311
Predicate : pred ,
2312
2312
Recursive : true ,
2313
2313
ResourceVersion : "12345" ,
@@ -3179,8 +3179,8 @@ func TestRetryAfterForUnreadyCache(t *testing.T) {
3179
3179
Predicate : storage .Everything ,
3180
3180
}
3181
3181
result := & example.PodList {}
3182
- proxy := NewCacheProxy (cacher , backingStorage )
3183
- err = proxy .GetList (context .TODO (), "/pods/ns" , opts , result )
3182
+ delegator := NewCacheDelegator (cacher , backingStorage )
3183
+ err = delegator .GetList (context .TODO (), "/pods/ns" , opts , result )
3184
3184
3185
3185
if ! apierrors .IsTooManyRequests (err ) {
3186
3186
t .Fatalf ("Unexpected GetList error: %v" , err )
0 commit comments