mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 06:15:45 +00:00
delete the hostport from usedmap
This commit is contained in:
parent
c0a519be1f
commit
195de933f1
@ -228,7 +228,7 @@ func TestExpirePod(t *testing.T) {
|
|||||||
},
|
},
|
||||||
allocatableResource: &Resource{},
|
allocatableResource: &Resource{},
|
||||||
pods: []*v1.Pod{testPods[1]},
|
pods: []*v1.Pod{testPods[1]},
|
||||||
usedPorts: map[int]bool{80: false, 8080: true},
|
usedPorts: map[int]bool{8080: true},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ func TestAddPodWillConfirm(t *testing.T) {
|
|||||||
},
|
},
|
||||||
allocatableResource: &Resource{},
|
allocatableResource: &Resource{},
|
||||||
pods: []*v1.Pod{testPods[0]},
|
pods: []*v1.Pod{testPods[0]},
|
||||||
usedPorts: map[int]bool{80: true, 8080: false},
|
usedPorts: map[int]bool{80: true},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -403,7 +403,11 @@ func (n *NodeInfo) updateUsedPorts(pod *v1.Pod, used bool) {
|
|||||||
// "0" is explicitly ignored in PodFitsHostPorts,
|
// "0" is explicitly ignored in PodFitsHostPorts,
|
||||||
// which is the only function that uses this value.
|
// which is the only function that uses this value.
|
||||||
if podPort.HostPort != 0 {
|
if podPort.HostPort != 0 {
|
||||||
n.usedPorts[int(podPort.HostPort)] = used
|
if used {
|
||||||
|
n.usedPorts[int(podPort.HostPort)] = used
|
||||||
|
} else {
|
||||||
|
delete(n.usedPorts, int(podPort.HostPort))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user