Merge pull request #19449 from hongchaodeng/fitport

PodFitsHostPorts: small refactor and speedup
This commit is contained in:
Mike Danese 2016-01-14 11:56:14 -08:00
commit f9f4b74a29

View File

@ -513,8 +513,11 @@ func (s *ServiceAffinity) CheckServiceAffinity(pod *api.Pod, existingPods []*api
}
func PodFitsHostPorts(pod *api.Pod, existingPods []*api.Pod, node string) (bool, error) {
existingPorts := getUsedPorts(existingPods...)
wantPorts := getUsedPorts(pod)
if len(wantPorts) == 0 {
return true, nil
}
existingPorts := getUsedPorts(existingPods...)
for wport := range wantPorts {
if wport == 0 {
continue