mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Endpoint controller logs errors during normal cluster behavior
This commit is contained in:
@@ -487,7 +487,9 @@ func (e *EndpointController) syncService(key string) {
|
|||||||
} else {
|
} else {
|
||||||
newEndpoints.Annotations[endpoints.PodHostnamesAnnotation] = serializedPodHostNames
|
newEndpoints.Annotations[endpoints.PodHostnamesAnnotation] = serializedPodHostNames
|
||||||
}
|
}
|
||||||
if len(currentEndpoints.ResourceVersion) == 0 {
|
|
||||||
|
createEndpoints := len(currentEndpoints.ResourceVersion) == 0
|
||||||
|
if createEndpoints {
|
||||||
// No previous endpoints, create them
|
// No previous endpoints, create them
|
||||||
_, err = e.client.Endpoints(service.Namespace).Create(newEndpoints)
|
_, err = e.client.Endpoints(service.Namespace).Create(newEndpoints)
|
||||||
} else {
|
} else {
|
||||||
@@ -495,7 +497,15 @@ func (e *EndpointController) syncService(key string) {
|
|||||||
_, err = e.client.Endpoints(service.Namespace).Update(newEndpoints)
|
_, err = e.client.Endpoints(service.Namespace).Update(newEndpoints)
|
||||||
}
|
}
|
||||||
if err != nil {
|
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
|
e.queue.Add(key) // Retry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user