mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #107494 from BinacsLee/binacs/remove-switch-for-binary-condition
cleanup: remove switch for binary condition in scheduler cache
This commit is contained in:
commit
bf8c918e0b
8
pkg/scheduler/internal/cache/cache.go
vendored
8
pkg/scheduler/internal/cache/cache.go
vendored
@ -534,8 +534,9 @@ func (cache *schedulerCache) RemovePod(pod *v1.Pod) error {
|
||||
defer cache.mu.Unlock()
|
||||
|
||||
currState, ok := cache.podStates[key]
|
||||
switch {
|
||||
case ok:
|
||||
if !ok {
|
||||
return fmt.Errorf("pod %v is not found in scheduler cache, so cannot be removed from it", key)
|
||||
}
|
||||
if currState.pod.Spec.NodeName != pod.Spec.NodeName {
|
||||
klog.ErrorS(nil, "Pod was added to a different node than it was assumed", "pod", klog.KObj(pod), "assumedNode", klog.KRef("", pod.Spec.NodeName), "currentNode", klog.KRef("", currState.pod.Spec.NodeName))
|
||||
if pod.Spec.NodeName != "" {
|
||||
@ -546,9 +547,6 @@ func (cache *schedulerCache) RemovePod(pod *v1.Pod) error {
|
||||
}
|
||||
}
|
||||
return cache.removePod(currState.pod)
|
||||
default:
|
||||
return fmt.Errorf("pod %v is not found in scheduler cache, so cannot be removed from it", key)
|
||||
}
|
||||
}
|
||||
|
||||
func (cache *schedulerCache) IsAssumedPod(pod *v1.Pod) (bool, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user