k3s/pkg/storage
k8s-merge-robot aa8fddb7d9 Merge pull request #25369 from liggitt/cached-watch
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().
2016-05-10 18:15:15 -07:00
..
etcd Never leak the etcd watcher's translate goroutine 2016-05-05 11:19:12 -07:00
etcd3 etcd3/watcher: refactor test 2016-05-10 12:37:31 -07:00
storagebackend start etcd compactor in background 2016-05-04 16:01:03 -07:00
testing Remove Set() from storage.Interface. 2016-04-04 17:54:18 +02:00
cacher.go Return 'too old' errors from watch cache via watch stream 2016-05-10 10:59:53 -04:00
cacher_test.go Return 'too old' errors from watch cache via watch stream 2016-05-10 10:59:53 -04:00
doc.go Move StorageInterface to pkg/storage. 2015-07-30 09:32:04 +02:00
errors.go etcd (v3) store: implements KV methods of storage.Interface 2016-03-30 10:20:39 -07:00
interfaces.go Decouple etcd node.expiration logic from DeleitonTimestamp 2016-04-13 15:11:53 -07:00
util.go add delete precondition 2016-03-25 11:21:39 -07:00
util_test.go add delete precondition 2016-03-25 11:21:39 -07:00
watch_cache.go Honor starting resourceVersion in watch cache 2016-04-14 09:37:22 -04:00
watch_cache_test.go Make watch cache behave like uncached watch 2016-04-12 10:14:07 -04:00