// podToEndpoint returns an Endpoint object generated from a Pod, a Node, and a Service for a particular addressType. func podToEndpoint(pod *v1.Pod, node *v1.Node, service *v1.Service, addressType discovery.AddressType) discovery.Endpoint { … } // getEndpointPorts returns a list of EndpointPorts generated from a Service // and Pod. func getEndpointPorts(logger klog.Logger, service *v1.Service, pod *v1.Pod) []discovery.EndpointPort { … } // getEndpointAddresses returns a list of addresses generated from a pod status. func getEndpointAddresses(podStatus v1.PodStatus, service *v1.Service, addressType discovery.AddressType) []string { … } // newEndpointSlice returns an EndpointSlice generated from a service and // endpointMeta. func newEndpointSlice(logger klog.Logger, service *v1.Service, endpointMeta *endpointMeta, controllerName string) *discovery.EndpointSlice { … } // getEndpointSlicePrefix returns a suitable prefix for an EndpointSlice name. func getEndpointSlicePrefix(serviceName string) string { … } // ownedBy returns true if the provided EndpointSlice is owned by the provided // Service. func ownedBy(endpointSlice *discovery.EndpointSlice, svc *v1.Service) bool { … } // getSliceToFill will return the EndpointSlice that will be closest to full // when numEndpoints are added. If no EndpointSlice can be found, a nil pointer // will be returned. func getSliceToFill(endpointSlices []*discovery.EndpointSlice, numEndpoints, maxEndpoints int) (slice *discovery.EndpointSlice) { … } // addTriggerTimeAnnotation adds a triggerTime annotation to an EndpointSlice func addTriggerTimeAnnotation(endpointSlice *discovery.EndpointSlice, triggerTime time.Time) { … } // ServiceControllerKey returns a controller key for a Service but derived from // an EndpointSlice. func ServiceControllerKey(endpointSlice *discovery.EndpointSlice) (string, error) { … } // setEndpointSliceLabels returns a map with the new endpoint slices labels and true if there was an update. // Slices labels must be equivalent to the Service labels except for the reserved IsHeadlessService, LabelServiceName and LabelManagedBy labels // Changes to IsHeadlessService, LabelServiceName and LabelManagedBy labels on the Service do not result in updates to EndpointSlice labels. func setEndpointSliceLabels(logger klog.Logger, epSlice *discovery.EndpointSlice, service *v1.Service, controllerName string) (map[string]string, bool) { … } // isReservedLabelKey return true if the label is one of the reserved label for slices func isReservedLabelKey(label string) bool { … } type endpointSliceEndpointLen … func (sl endpointSliceEndpointLen) Len() int { … } func (sl endpointSliceEndpointLen) Swap(i, j int) { … } func (sl endpointSliceEndpointLen) Less(i, j int) bool { … } // returns a map of address types used by a service func getAddressTypesForService(logger klog.Logger, service *v1.Service) sets.Set[discovery.AddressType] { … } func unchangedSlices(existingSlices, slicesToUpdate, slicesToDelete []*discovery.EndpointSlice) []*discovery.EndpointSlice { … } // hintsEnabled returns true if the provided annotations include either // v1.AnnotationTopologyMode or v1.DeprecatedAnnotationTopologyAwareHints key // with a value set to "Auto" or "auto". When both are set, // v1.DeprecatedAnnotationTopologyAwareHints has precedence. func hintsEnabled(annotations map[string]string) bool { … } // isServiceIPSet aims to check if the service's ClusterIP is set or not // the objective is not to perform validation here // copied from k8s.io/kubernetes/pkg/apis/core/v1/helper func isServiceIPSet(service *v1.Service) bool { … } // findPort locates the container port for the given pod and portName. If the // targetPort is a number, use that. If the targetPort is a string, look that // string up in all named ports in all containers in the target pod. If no // match is found, fail. // copied from k8s.io/kubernetes/pkg/api/v1/pod func findPort(pod *v1.Pod, svcPort *v1.ServicePort) (int, error) { … }