mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Short-circuit attemptToDelete loop for virtual nodes that are removed or observed
Virtual nodes are added to the attemptToDelete queue, and continue getting requeued until they are successfully verified absent or are observed via informer. In the meantime, if the real object associated with that UID is observed via informer, or is observed to be deleted via informer, the graph node for that UID can be removed or marked as observed. In that case, we should stop retrying to get the virtual node coordinates.
This commit is contained in:
parent
cae56bea0a
commit
78317edb8b
@ -310,6 +310,23 @@ func (gc *GarbageCollector) attemptToDeleteWorker() bool {
|
||||
utilruntime.HandleError(fmt.Errorf("expect *node, got %#v", item))
|
||||
return true
|
||||
}
|
||||
|
||||
if !n.isObserved() {
|
||||
nodeFromGraph, existsInGraph := gc.dependencyGraphBuilder.uidToNode.Read(n.identity.UID)
|
||||
if !existsInGraph {
|
||||
// this can happen if attemptToDelete loops on a requeued virtual node because attemptToDeleteItem returned an error,
|
||||
// and in the meantime a deletion of the real object associated with that uid was observed
|
||||
klog.V(5).Infof("item %s no longer in the graph, skipping attemptToDeleteItem", n)
|
||||
return true
|
||||
}
|
||||
if nodeFromGraph.isObserved() {
|
||||
// this can happen if attemptToDelete loops on a requeued virtual node because attemptToDeleteItem returned an error,
|
||||
// and in the meantime the real object associated with that uid was observed
|
||||
klog.V(5).Infof("item %s no longer virtual in the graph, skipping attemptToDeleteItem on virtual node", n)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
err := gc.attemptToDeleteItem(n)
|
||||
if err == enqueuedVirtualDeleteEventErr {
|
||||
// a virtual event was produced and will be handled by processGraphChanges, no need to requeue this node
|
||||
|
Loading…
Reference in New Issue
Block a user