mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Port TestLastChangeTriggerTime from Endpoints tracker to EndpointSlice
This exposed a bug in the EndpointSlice tracking code, which is that we didn't properly reset the "last change time" when a slice was deleted. (This means kube-proxy would report an erroneous value in the "endpoint programming time" metric if a service was added/updated, then deleted before kube-proxy processed the add/update, then later added again.)
This commit is contained in:
@@ -293,7 +293,9 @@ func (ect *EndpointChangeTracker) EndpointSliceUpdate(endpointSlice *discovery.E
|
||||
// we want to measure. So we simply ignore it in this cases.
|
||||
// TODO(wojtek-t, robscott): Address the problem for EndpointSlice deletion
|
||||
// when other EndpointSlice for that service still exist.
|
||||
if t := getLastChangeTriggerTime(endpointSlice.Annotations); !t.IsZero() && !removeSlice && t.After(ect.trackerStartTime) {
|
||||
if removeSlice {
|
||||
delete(ect.lastChangeTriggerTimes, namespacedName)
|
||||
} else if t := getLastChangeTriggerTime(endpointSlice.Annotations); !t.IsZero() && t.After(ect.trackerStartTime) {
|
||||
ect.lastChangeTriggerTimes[namespacedName] =
|
||||
append(ect.lastChangeTriggerTimes[namespacedName], t)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user