• k8s-merge-robot's avatar
    Merge pull request #25369 from liggitt/cached-watch · aa8fddb7
    k8s-merge-robot authored
    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().
    aa8fddb7
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api/swagger-spec Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
contrib Loading commit data...
docs Loading commit data...
examples Loading commit data...
federation Loading commit data...
hack Loading commit data...
hooks Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
release Loading commit data...
test Loading commit data...
third_party Loading commit data...
vendor Loading commit data...
www Loading commit data...
.generated_docs Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIB.md Loading commit data...
CONTRIBUTING.md Loading commit data...
DESIGN.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
Vagrantfile Loading commit data...
code-of-conduct.md Loading commit data...