Clear EndpointsLastChangeTriggerTime on no-change.

We should clean the EndpointsLastChangeTriggerTime annotation when there
is no new trigger time to be exported. Not clearing it may result in
kube-proxy exporting the wrong Network Programming Latency SLI.
This commit is contained in:
Matt Matejczyk
2019-02-20 11:48:24 +01:00
parent d61e878533
commit bf25f7160b
2 changed files with 48 additions and 0 deletions

View File

@@ -522,6 +522,8 @@ func (e *EndpointController) syncService(key string) error {
if !endpointsLastChangeTriggerTime.IsZero() {
newEndpoints.Annotations[v1.EndpointsLastChangeTriggerTime] =
endpointsLastChangeTriggerTime.Format(time.RFC3339Nano)
} else { // No new trigger time, clear the annotation.
delete(newEndpoints.Annotations, v1.EndpointsLastChangeTriggerTime)
}
klog.V(4).Infof("Update endpoints for %v/%v, ready: %d not ready: %d", service.Namespace, service.Name, totalReadyEps, totalNotReadyEps)