Add utility for discovering managed objects
This MR introduces kube.DiscoverManagedObjects
, a utility function that finds all Kubernetes objects that are owned by another resource. The owner is generally a CustomResource. One common usage is for a controller to discover its managed resources.
The current implementation relies on the OwnerReferences of objects to determine if it is managed by another object. It selects the objects that refer to the specified owner.
The function has a set of options, including the auto-discovery option which discovers API resource types from cluster rather than using the user-specified values.
Related to #889 (closed)
Edited by Hossein Pursultani