type TriggerTimeTracker … // NewTriggerTimeTracker creates a new instance of the TriggerTimeTracker. func NewTriggerTimeTracker() *TriggerTimeTracker { … } type ServiceKey … type ServiceState … // ComputeEndpointLastChangeTriggerTime updates the state of the Service/Endpoint // object being synced and returns the time that should be exported as the // EndpointsLastChangeTriggerTime annotation. // // If the method returns a 'zero' time the EndpointsLastChangeTriggerTime // annotation shouldn't be exported. // // Please note that this function may compute a wrong value if the same object // (pod/service) changes multiple times between two consecutive syncs. // // Important: This method is go-routing safe but only when called for different // keys. The method shouldn't be called concurrently for the same key! This // contract is fulfilled in the current implementation of the endpoint(slice) // controller. func (t *TriggerTimeTracker) ComputeEndpointLastChangeTriggerTime( namespace string, service *v1.Service, pods []*v1.Pod) time.Time { … } // DeleteService deletes service state stored in this util. func (t *TriggerTimeTracker) DeleteService(namespace, name string) { … } // getPodTriggerTime returns the time of the pod change (trigger) that resulted // or will result in the endpoint object change. func getPodTriggerTime(pod *v1.Pod) (triggerTime time.Time) { … } // getServiceTriggerTime returns the time of the service change (trigger) that // resulted or will result in the endpoint change. func getServiceTriggerTime(service *v1.Service) (triggerTime time.Time) { … } // min returns minimum of the currentMin and newValue or newValue if the currentMin is not set. func min(currentMin, newValue time.Time) time.Time { … }