code: func (lbc *loadBalancerController) getEndpoints(
  	s *api.Service, servicePort *api.ServicePort) (endpoints []string) {
  	ep, err := lbc.epLister.GetServiceEndpoints(s)
  	if err != nil {
  		return
  	}
  
  	// The intent here is to create a union of all subsets that match a targetPort.
  	// We know the endpoint already matches the service, so all pod ips that have
  	// the target port are capable of service traffic for it.
  	for _, ss := range ep.Subsets {
  		for _, epPort := range ss.Ports {
  			var targetPort int
  			switch servicePort.TargetPort.Type {
  			case intstr.Int:
  				if epPort.Port == getTargetPort(servicePort) {
  					targetPort = epPort.Port
  				}
  			case intstr.String:
  				if epPort.Name == servicePort.TargetPort.StrVal {
  					targetPort = epPort.Port
  				}
  			}
  			if targetPort == 0 {
  				continue
  			}
  			for _, epAddress := range ss.Addresses {
  				endpoints = append(endpoints, fmt.Sprintf("%v:%v", epAddress.IP, targetPort))
  			}
  		}
  	}
  	return
  }
docs: // getEndpoints returns a list of <endpoint ip>:<port> for a given service/target port combination.