Avoid marking virtual nodes as observed when they haven't been
Virtual nodes can be added to the GC graph in order to represent objects which have not been observed via an informer, but are referenced via ownerReferences. These virtual nodes are requeued into attemptToDelete until they are observed via an informer, or successfully verified absent via a live lookup. Previously, both of those code paths called markObserved() to stop requeuing into attemptToDelete. Because it is useful to know whether a particular node has been observed via a real informer event, this commit does the following: * adds a `virtual bool` attribute to graph events so we know which ones came from a real informer * limits the markObserved() call to the code path where a real informer event is observed * uses an alternative mechanism to stop requeueing into attemptToDelete when a virtual node is verified absent via a live lookup
This commit is contained in:
@@ -274,12 +274,16 @@ func TestAttemptToDeleteItem(t *testing.T) {
|
||||
Namespace: pod.Namespace,
|
||||
},
|
||||
// owners are intentionally left empty. The attemptToDeleteItem routine should get the latest item from the server.
|
||||
owners: nil,
|
||||
owners: nil,
|
||||
virtual: true,
|
||||
}
|
||||
err := gc.attemptToDeleteItem(item)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected Error: %v", err)
|
||||
}
|
||||
if !item.virtual {
|
||||
t.Errorf("attemptToDeleteItem changed virtual to false unexpectedly")
|
||||
}
|
||||
expectedActionSet := sets.NewString()
|
||||
expectedActionSet.Insert("GET=/api/v1/namespaces/ns1/replicationcontrollers/owner1")
|
||||
expectedActionSet.Insert("DELETE=/api/v1/namespaces/ns1/pods/ToBeDeletedPod")
|
||||
|
Reference in New Issue
Block a user