mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Minor improvements to scheduling queue
This commit is contained in:
parent
ecc5eb67d9
commit
5a00c42848
@ -484,29 +484,17 @@ var _ = UnschedulablePods(&UnschedulablePodsMap{})
|
|||||||
|
|
||||||
// Add adds a pod to the unschedulable pods.
|
// Add adds a pod to the unschedulable pods.
|
||||||
func (u *UnschedulablePodsMap) Add(pod *v1.Pod) {
|
func (u *UnschedulablePodsMap) Add(pod *v1.Pod) {
|
||||||
podKey := u.keyFunc(pod)
|
u.pods[u.keyFunc(pod)] = pod
|
||||||
if _, exists := u.pods[podKey]; !exists {
|
|
||||||
u.pods[podKey] = pod
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes a pod from the unschedulable pods.
|
// Delete deletes a pod from the unschedulable pods.
|
||||||
func (u *UnschedulablePodsMap) Delete(pod *v1.Pod) {
|
func (u *UnschedulablePodsMap) Delete(pod *v1.Pod) {
|
||||||
podKey := u.keyFunc(pod)
|
delete(u.pods, u.keyFunc(pod))
|
||||||
if _, exists := u.pods[podKey]; exists {
|
|
||||||
delete(u.pods, podKey)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates a pod in the unschedulable pods.
|
// Update updates a pod in the unschedulable pods.
|
||||||
func (u *UnschedulablePodsMap) Update(pod *v1.Pod) {
|
func (u *UnschedulablePodsMap) Update(pod *v1.Pod) {
|
||||||
podKey := u.keyFunc(pod)
|
u.Add(pod)
|
||||||
_, exists := u.pods[podKey]
|
|
||||||
if !exists {
|
|
||||||
u.Add(pod)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
u.pods[podKey] = pod
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the pod if a pod with the same key as the key of the given "pod"
|
// Get returns the pod if a pod with the same key as the key of the given "pod"
|
||||||
|
Loading…
Reference in New Issue
Block a user