type ServiceChangeTracker … type makeServicePortFunc … type processServiceMapChangeFunc … type serviceChange … // NewServiceChangeTracker initializes a ServiceChangeTracker func NewServiceChangeTracker(makeServiceInfo makeServicePortFunc, ipFamily v1.IPFamily, recorder events.EventRecorder, processServiceMapChange processServiceMapChangeFunc) *ServiceChangeTracker { … } // Update updates the ServiceChangeTracker based on the <previous, current> service pair // (where either previous or current, but not both, can be nil). It returns true if sct // contains changes that need to be synced (whether or not those changes were caused by // this update); note that this is different from the return value of // EndpointChangeTracker.EndpointSliceUpdate(). func (sct *ServiceChangeTracker) Update(previous, current *v1.Service) bool { … } type ServicePortMap … type UpdateServiceMapResult … // HealthCheckNodePorts returns a map of Service names to HealthCheckNodePort values // for all Services in sm with non-zero HealthCheckNodePort. func (sm ServicePortMap) HealthCheckNodePorts() map[types.NamespacedName]uint16 { … } // serviceToServiceMap translates a single Service object to a ServicePortMap. // // NOTE: service object should NOT be modified. func (sct *ServiceChangeTracker) serviceToServiceMap(service *v1.Service) ServicePortMap { … } // Update updates ServicePortMap base on the given changes, returns information about the // diff since the last Update, triggers processServiceMapChange on every change, and // clears the changes map. func (sm ServicePortMap) Update(sct *ServiceChangeTracker) UpdateServiceMapResult { … } // merge adds other ServicePortMap's elements to current ServicePortMap. // If collision, other ALWAYS win. Otherwise add the other to current. // In other words, if some elements in current collisions with other, update the current by other. func (sm *ServicePortMap) merge(other ServicePortMap) { … } // filter filters out elements from ServicePortMap base on given ports string sets. func (sm *ServicePortMap) filter(other ServicePortMap) { … } // unmerge deletes all other ServicePortMap's elements from current ServicePortMap and // updates deletedUDPClusterIPs with all of the newly-deleted UDP cluster IPs. func (sm *ServicePortMap) unmerge(other ServicePortMap, deletedUDPClusterIPs sets.Set[string]) { … }