mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-24 11:29:09 +00:00
Ensure deletion of pods in queues and cache
When the client misses a delete event from the watcher, it will use the last state of the pod in the informer cache to produce a delete event. At that point, it's not clear if the pod was in the queues or the cache, so we should issue a deletion in both. The pod could be assumed, so deletion of assumed pods from the cache should work. Change-Id: I11ce9785de603924fc121fe2fa6ed5cb1e16922f
This commit is contained in:
@@ -270,8 +270,10 @@ func addAllEventHandlers(
|
||||
case *v1.Pod:
|
||||
return assignedPod(t)
|
||||
case cache.DeletedFinalStateUnknown:
|
||||
if pod, ok := t.Obj.(*v1.Pod); ok {
|
||||
return assignedPod(pod)
|
||||
if _, ok := t.Obj.(*v1.Pod); ok {
|
||||
// The carried object may be stale, so we don't use it to check if
|
||||
// it's assigned or not. Attempting to cleanup anyways.
|
||||
return true
|
||||
}
|
||||
utilruntime.HandleError(fmt.Errorf("unable to convert object %T to *v1.Pod in %T", obj, sched))
|
||||
return false
|
||||
@@ -296,7 +298,9 @@ func addAllEventHandlers(
|
||||
return !assignedPod(t) && responsibleForPod(t, sched.Profiles)
|
||||
case cache.DeletedFinalStateUnknown:
|
||||
if pod, ok := t.Obj.(*v1.Pod); ok {
|
||||
return !assignedPod(pod) && responsibleForPod(pod, sched.Profiles)
|
||||
// The carried object may be stale, so we don't use it to check if
|
||||
// it's assigned or not.
|
||||
return responsibleForPod(pod, sched.Profiles)
|
||||
}
|
||||
utilruntime.HandleError(fmt.Errorf("unable to convert object %T to *v1.Pod in %T", obj, sched))
|
||||
return false
|
||||
|
Reference in New Issue
Block a user