From fce19094830db80db9f54e7f0d05b566f996057b Mon Sep 17 00:00:00 2001 From: Matt Matejczyk Date: Wed, 13 Feb 2019 09:11:59 +0100 Subject: [PATCH] Don't log warning when EndpointsLastChangeTriggerTime not set. --- pkg/proxy/endpoints.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/proxy/endpoints.go b/pkg/proxy/endpoints.go index e42bd3a380..21f10cdcbf 100644 --- a/pkg/proxy/endpoints.go +++ b/pkg/proxy/endpoints.go @@ -161,6 +161,11 @@ func (ect *EndpointChangeTracker) Update(previous, current *v1.Endpoints) bool { // annotation stored in the given endpoints object or the "zero" time if the annotation wasn't set // or was set incorrectly. func getLastChangeTriggerTime(endpoints *v1.Endpoints) time.Time { + if _, ok := endpoints.Annotations[v1.EndpointsLastChangeTriggerTime]; !ok { + // It's possible that the Endpoints object won't have the EndpointsLastChangeTriggerTime + // annotation set. In that case return the 'zero value', which is ignored in the upstream code. + return time.Time{} + } val, err := time.Parse(time.RFC3339Nano, endpoints.Annotations[v1.EndpointsLastChangeTriggerTime]) if err != nil { klog.Warningf("Error while parsing EndpointsLastChangeTriggerTimeAnnotation: '%s'. Error is %v",