Ensure dependents are added to virtual node before attemptToDelete

This commit is contained in:
Jordan Liggitt 2017-12-21 01:07:07 -05:00
parent 754bb1350f
commit a7c7da76d5
No known key found for this signature in database
GPG Key ID: 39928704103C7229

View File

@ -382,10 +382,7 @@ func (gb *GraphBuilder) addDependentToOwners(n *node, owners []metav1.OwnerRefer
ownerNode, ok := gb.uidToNode.Read(owner.UID) ownerNode, ok := gb.uidToNode.Read(owner.UID)
if !ok { if !ok {
// Create a "virtual" node in the graph for the owner if it doesn't // Create a "virtual" node in the graph for the owner if it doesn't
// exist in the graph yet. Then enqueue the virtual node into the // exist in the graph yet.
// attemptToDelete. The garbage processor will enqueue a virtual delete
// event to delete it from the graph if API server confirms this
// owner doesn't exist.
ownerNode = &node{ ownerNode = &node{
identity: objectReference{ identity: objectReference{
OwnerReference: owner, OwnerReference: owner,
@ -395,9 +392,15 @@ func (gb *GraphBuilder) addDependentToOwners(n *node, owners []metav1.OwnerRefer
} }
glog.V(5).Infof("add virtual node.identity: %s\n\n", ownerNode.identity) glog.V(5).Infof("add virtual node.identity: %s\n\n", ownerNode.identity)
gb.uidToNode.Write(ownerNode) gb.uidToNode.Write(ownerNode)
gb.attemptToDelete.Add(ownerNode)
} }
ownerNode.addDependent(n) ownerNode.addDependent(n)
if !ok {
// Enqueue the virtual node into attemptToDelete.
// The garbage processor will enqueue a virtual delete
// event to delete it from the graph if API server confirms this
// owner doesn't exist.
gb.attemptToDelete.Add(ownerNode)
}
} }
} }