When connections are broken on Watch, write fewer errors to logs

Watch depends on long running connections, which intervening proxies may break without the control of the remote server. Specific errors handled are io.EOF, io.EOF wrapped by *url.Error, http connection
reset errors (caused by race conditions in golang http code), and connection reset by peer (simply tolerated).
Seriously - golang stdlib error handling makes me cry.

----- Original Message -----
> > @@ -310,6 +314,25 @@ func (r *Request) Watch() (watch.Interface, error) {
> >  	return watch.NewStreamWatcher(watchjson.NewDecoder(resp.Body, r.codec)),
> >  	nil
> >  }
> >  
> > +// isProbableEOF returns true if the given error resembles a connection
> > termination
> > +// scenario that would justify assuming that the watch is empty. The watch
> > stream
> > +// mechanism handles many common partial data errors, so closed
> > connections can be
> > +// retried in many cases.
> > +func isProbableEOF(err error) bool {
> > +	if uerr, ok := err.(*url.Error); ok {
> > +		err = uerr.Err
> > +	}
> > +	switch {
> > +	case err == io.EOF:
> > +		return true
> > +	case err.Error() == "http: can't write HTTP request on broken
> > connection":
> 
> Bad net/http package. ಠ_ಠ
> 
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/GoogleCloudPlatform/kubernetes/pull/3037/files#r22070294