Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle error from watch. #2733

Merged
merged 1 commit into from
Dec 3, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 31 additions & 2 deletions pkg/proxy/config/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,22 @@ func handleServicesWatch(resourceVersion *string, ch <-chan watch.Event, updates
return
}

service := event.Object.(*api.Service)
if event.Object == nil {
glog.Errorf("Got nil over WatchServices channel")
return
}
var service *api.Service
switch obj := event.Object.(type) {
case *api.Service:
service = obj
case *api.Status:
glog.Warningf("Got error status on WatchServices channel: %+v", obj)
return
default:
glog.Errorf("Got unexpected object over WatchServices channel: %+v", obj)
return
}

*resourceVersion = service.ResourceVersion

switch event.Type {
Expand Down Expand Up @@ -161,7 +176,21 @@ func handleEndpointsWatch(resourceVersion *string, ch <-chan watch.Event, update
return
}

endpoints := event.Object.(*api.Endpoints)
if event.Object == nil {
glog.Errorf("Got nil over WatchEndpoints channel")
return
}
var endpoints *api.Endpoints
switch obj := event.Object.(type) {
case *api.Endpoints:
endpoints = obj
case *api.Status:
glog.Warningf("Got error status on WatchEndpoints channel: %+v", obj)
return
default:
glog.Errorf("Got unexpected object over WatchEndpoints channel: %+v", obj)
return
}
*resourceVersion = endpoints.ResourceVersion

switch event.Type {
Expand Down