Merge pull request #124867 from p0lyn0mial/upstream-progress-notification-for-waitUntilWatchCacheFreshAndForceAllEvents
storage/cacher: waitUntilWatchCacheFreshAndForceAllEvents checks if storage.RequestWatchProgress is supported
This commit is contained in:
		@@ -1296,9 +1296,14 @@ func (c *Cacher) getWatchCacheResourceVersion(ctx context.Context, parsedWatchRe
 | 
				
			|||||||
// can wait for events without unnecessary blocking.
 | 
					// can wait for events without unnecessary blocking.
 | 
				
			||||||
func (c *Cacher) waitUntilWatchCacheFreshAndForceAllEvents(ctx context.Context, requestedWatchRV uint64, opts storage.ListOptions) error {
 | 
					func (c *Cacher) waitUntilWatchCacheFreshAndForceAllEvents(ctx context.Context, requestedWatchRV uint64, opts storage.ListOptions) error {
 | 
				
			||||||
	if opts.SendInitialEvents != nil && *opts.SendInitialEvents {
 | 
						if opts.SendInitialEvents != nil && *opts.SendInitialEvents {
 | 
				
			||||||
		// TODO(p0lyn0mial): adapt the following logic once
 | 
							// Here be dragons:
 | 
				
			||||||
		//   https://github.com/kubernetes/kubernetes/pull/123264 merges
 | 
							// Since the etcd feature checker needs to check all members
 | 
				
			||||||
		if utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache) && c.watchCache.notFresh(requestedWatchRV) {
 | 
							// to determine whether a given feature is supported,
 | 
				
			||||||
 | 
							// we may receive a positive response even if the feature is not supported.
 | 
				
			||||||
 | 
							//
 | 
				
			||||||
 | 
							// In this very rare scenario, the worst case will be that this
 | 
				
			||||||
 | 
							// request will wait for 3 seconds before it fails.
 | 
				
			||||||
 | 
							if etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RequestWatchProgress) && c.watchCache.notFresh(requestedWatchRV) {
 | 
				
			||||||
			c.watchCache.waitingUntilFresh.Add()
 | 
								c.watchCache.waitingUntilFresh.Add()
 | 
				
			||||||
			defer c.watchCache.waitingUntilFresh.Remove()
 | 
								defer c.watchCache.waitingUntilFresh.Remove()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user