tl;dr how does apiserver maintain mapping of parent:child objects, it appears it only has child:parent mapping.
Reading Garbage Collection docs and the biggest question in my mind is that how’s the garbage collection or features like blockOwnerDeletion
efficiently implemented?
To illustrate it better: Imagine there are hundreds of thousands of individual objects of different kinds in a namespace, and any one of them can list a particular object in the ownerReferences
. In this situation, when an “owner” object is deleted, how does the apiserver find what are its children?
There’s a reference from the child object to its parent, but not vice versa. So how does the api find an object’s children during cascading deletion without exhaustively searching all objects? Or when a parent object is being deleted, how does apiserver enforce constraints like blockOwnerDeletion
that was listed on a child object without doing similar exhaustive searching?