Skip to content

Commit

Permalink
UPSTREAM: <carry>: fallback for consistent reads from cache only if R…
Browse files Browse the repository at this point in the history
…esilientWatchCacheInitialization is enabled
  • Loading branch information
bertinatto committed Sep 19, 2024
1 parent 9bf64d5 commit 17575c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,10 @@ func (c *Cacher) GetList(ctx context.Context, key string, opts storage.ListOptio
preparedKey += "/"
}
requestWatchProgressSupported := etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RequestWatchProgress)
consistentRead := resourceVersion == "" && utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache) && requestWatchProgressSupported
consistentRead := resourceVersion == "" &&
utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache) &&
utilfeature.DefaultFeatureGate.Enabled(features.ResilientWatchCacheInitialization) &&
requestWatchProgressSupported
if consistentRead {
listRV, err = storage.GetCurrentResourceVersionFromStorage(ctx, c.storage, c.newListFunc, c.resourcePrefix, c.objectType.String())
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ apiserver_watch_cache_consistent_read_total{fallback="true", resource="pods", su
for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ConsistentListFromCache, tc.consistentReadsEnabled)
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ResilientWatchCacheInitialization, true)
if tc.consistentReadsEnabled {
forceRequestWatchProgressSupport(t)
}
Expand Down

0 comments on commit 17575c0

Please sign in to comment.