mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-25 04:11:46 +00:00
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).
This commit is contained in:
@@ -56,6 +56,26 @@ type Event struct {
|
||||
Object runtime.Object
|
||||
}
|
||||
|
||||
type emptyWatch chan Event
|
||||
|
||||
// NewEmptyWatch returns a watch interface that returns no results and is closed.
|
||||
// May be used in certain error conditions where no information is available but
|
||||
// an error is not warranted.
|
||||
func NewEmptyWatch() Interface {
|
||||
ch := make(chan Event)
|
||||
close(ch)
|
||||
return emptyWatch(ch)
|
||||
}
|
||||
|
||||
// Stop implements Interface
|
||||
func (w emptyWatch) Stop() {
|
||||
}
|
||||
|
||||
// ResultChan implements Interface
|
||||
func (w emptyWatch) ResultChan() <-chan Event {
|
||||
return chan Event(w)
|
||||
}
|
||||
|
||||
// FakeWatcher lets you test anything that consumes a watch.Interface; threadsafe.
|
||||
type FakeWatcher struct {
|
||||
result chan Event
|
||||
|
Reference in New Issue
Block a user