mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 15:13:08 +00:00
handle watch errors everywhere
This commit is contained in:
@@ -60,18 +60,18 @@ func NewSourceEtcd(key string, client tools.EtcdClient, updates chan<- interface
|
||||
}
|
||||
|
||||
func (s *SourceEtcd) run() {
|
||||
watching, err := s.helper.Watch(s.key, 0)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to initialize etcd watch: %v", err)
|
||||
return
|
||||
}
|
||||
watching := s.helper.Watch(s.key, 0)
|
||||
for {
|
||||
select {
|
||||
case event, ok := <-watching.ResultChan():
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if event.Type == watch.Error {
|
||||
glog.Errorf("Watch error: %v", event.Object)
|
||||
watching.Stop()
|
||||
return
|
||||
}
|
||||
pods, err := eventToPods(event)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to parse result from etcd watch: %v", err)
|
||||
|
Reference in New Issue
Block a user