code: func LookupContainerPortNumberByServicePort(svc v1.Service, pod v1.Pod, port int32) (int32, error) {
  	for _, svcportspec := range svc.Spec.Ports {
  		if svcportspec.Port != port {
  			continue
  		}
  		if svc.Spec.ClusterIP == v1.ClusterIPNone {
  			return port, nil
  		}
  		if svcportspec.TargetPort.Type == intstr.Int {
  			if svcportspec.TargetPort.IntValue() == 0 {
  				// targetPort is omitted, and the IntValue() would be zero
  				return svcportspec.Port, nil
  			}
  			return int32(svcportspec.TargetPort.IntValue()), nil
  		}
  		return LookupContainerPortNumberByName(pod, svcportspec.TargetPort.String())
  	}
  	return port, fmt.Errorf("Service %s does not have a service port %d", svc.Name, port)
  }
docs: // LookupContainerPortNumberByServicePort implements
  // the handling of resolving container named port, as well as ignoring targetPort when clusterIP=None
  // It returns an error when a named port can't find a match (with -1 returned), or when the service does not
  // declare such port (with the input port number returned).