Skip to content

Commit

Permalink
Merge pull request #24833 from a-robinson/lbevent
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

Fix DeletingLoadBalancer event generation.

release-note:
```release-note
Fix DeletingLoadBalancer event generation.
```

Also patch up a log statement to log the service's namespace and name
rather than potentially just logging `kind:"" apiVersion:""`.

It doesn't work as written because `service` is always nil on this line. If it wasn't, then we wouldn't have taken this branch. `deltaService` is what contains the info that we have about the service.

Example of how the event generation fails as currently written:
```
E0426 22:18:41.726835      10 event.go:257] Could not construct reference to: '&api.Service{TypeMeta:unversioned.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:api.ObjectMeta{Name:"", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:unversioned.Time{Time:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*unversioned.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil)}, Spec:api.ServiceSpec{Type:"", Ports:[]api.ServicePort(nil), Selector:map[string]string(nil), ClusterIP:"", ExternalIPs:[]string(nil), LoadBalancerIP:"", SessionAffinity:""}, Status:api.ServiceStatus{LoadBalancer:api.LoadBalancerStatus{Ingress:[]api.LoadBalancerIngress(nil)}}}' due to: 'selfLink was empty, can't make reference'. Will not report event: 'Normal' 'DeletingLoadBalancer' 'Deleting load balancer'
```
  • Loading branch information
k8s-merge-robot committed Apr 27, 2016
2 parents fa3c49b + ed15931 commit a907794
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/service/servicecontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (s *ServiceController) processDelta(delta *cache.Delta) (error, time.Durati
namespacedName.Name = deltaService.Name
cachedService = s.cache.getOrCreate(namespacedName.String())
}
glog.V(2).Infof("Got new %s delta for service: %+v", delta.Type, deltaService)
glog.V(2).Infof("Got new %s delta for service: %v", delta.Type, namespacedName)

// Ensure that no other goroutine will interfere with our processing of the
// service.
Expand All @@ -249,7 +249,7 @@ func (s *ServiceController) processDelta(delta *cache.Delta) (error, time.Durati
return err, cachedService.nextRetryDelay()
} else if errors.IsNotFound(err) {
glog.V(2).Infof("Service %v not found, ensuring load balancer is deleted", namespacedName)
s.eventRecorder.Event(service, api.EventTypeNormal, "DeletingLoadBalancer", "Deleting load balancer")
s.eventRecorder.Event(deltaService, api.EventTypeNormal, "DeletingLoadBalancer", "Deleting load balancer")
err := s.balancer.EnsureLoadBalancerDeleted(deltaService)
if err != nil {
message := "Error deleting load balancer (will retry): " + err.Error()
Expand Down

0 comments on commit a907794

Please sign in to comment.