diff --git a/pkg/controller/endpoint/endpoints_controller.go b/pkg/controller/endpoint/endpoints_controller.go index 4dfa6619ce5..8a1f5c44a97 100644 --- a/pkg/controller/endpoint/endpoints_controller.go +++ b/pkg/controller/endpoint/endpoints_controller.go @@ -487,7 +487,9 @@ func (e *EndpointController) syncService(key string) { } else { newEndpoints.Annotations[endpoints.PodHostnamesAnnotation] = serializedPodHostNames } - if len(currentEndpoints.ResourceVersion) == 0 { + + createEndpoints := len(currentEndpoints.ResourceVersion) == 0 + if createEndpoints { // No previous endpoints, create them _, err = e.client.Endpoints(service.Namespace).Create(newEndpoints) } else { @@ -495,7 +497,15 @@ func (e *EndpointController) syncService(key string) { _, err = e.client.Endpoints(service.Namespace).Update(newEndpoints) } if err != nil { - glog.Errorf("Error updating endpoints: %v", err) + if createEndpoints && errors.IsForbidden(err) { + // A request is forbidden primarily for two reasons: + // 1. namespace is terminating, endpoint creation is not allowed by default. + // 2. policy is misconfigured, in which case no service would function anywhere. + // Given the frequency of 1, we log at a lower level. + glog.V(5).Infof("Forbidden from creating endpoints: %v", err) + } else { + utilruntime.HandleError(err) + } e.queue.Add(key) // Retry } }