mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
PodFitsHostPorts: small refactor and speedup
This commit is contained in:
parent
ce9b117a19
commit
91fa5f8c88
@ -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) {
|
func PodFitsHostPorts(pod *api.Pod, existingPods []*api.Pod, node string) (bool, error) {
|
||||||
existingPorts := getUsedPorts(existingPods...)
|
|
||||||
wantPorts := getUsedPorts(pod)
|
wantPorts := getUsedPorts(pod)
|
||||||
|
if len(wantPorts) == 0 {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
existingPorts := getUsedPorts(existingPods...)
|
||||||
for wport := range wantPorts {
|
for wport := range wantPorts {
|
||||||
if wport == 0 {
|
if wport == 0 {
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user