mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-02-22 09:21:19 -05:00
Automatic merge from submit-queue Return 'too old' errors from watch cache via watch stream Fixes #25151 This PR updates the API server to produce the same results when a watch is attempted with a resourceVersion that is too old, regardless of whether the etcd watch cache is enabled. The expected result is a `200` http status, with a single watch event of type `ERROR`. Previously, the watch cache would deliver a `410` http response. This is the uncached watch impl: ``` // Implements storage.Interface. func (h *etcdHelper) WatchList(ctx context.Context, key string, resourceVersion string, filter storage.FilterFunc) (watch.Interface, error) { if ctx == nil { glog.Errorf("Context is nil") } watchRV, err := storage.ParseWatchResourceVersion(resourceVersion) if err != nil { return nil, err } key = h.prefixEtcdKey(key) w := newEtcdWatcher(true, h.quorum, exceptKey(key), filter, h.codec, h.versioner, nil, h) go w.etcdWatch(ctx, h.etcdKeysAPI, key, watchRV) return w, nil } ``` once the resourceVersion parses, there is no path that returns a direct error, so all errors would have to be returned as an `ERROR` event via the ResultChan(). |
||
|---|---|---|
| .. | ||
| etcd | ||
| etcd3 | ||
| storagebackend | ||
| testing | ||
| cacher.go | ||
| cacher_test.go | ||
| doc.go | ||
| errors.go | ||
| interfaces.go | ||
| util.go | ||
| util_test.go | ||
| watch_cache.go | ||
| watch_cache_test.go | ||