Skip to content

Commit

Permalink
Only respect controller refs for resources
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Pryor <[email protected]>
  • Loading branch information
mkjpryor committed Feb 24, 2023
1 parent ed70eac commit 7f11a50
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/cache/references.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ func mightHaveInferredOwner(r *Resource) bool {

func (c *clusterCache) resolveResourceReferences(un *unstructured.Unstructured) ([]metav1.OwnerReference, func(kube.ResourceKey) bool) {
var isInferredParentOf func(_ kube.ResourceKey) bool
ownerRefs := un.GetOwnerReferences()
allOwnerRefs := un.GetOwnerReferences()
gvk := un.GroupVersionKind()

// TODO: Put this behind a gate
ownerRefs := []metav1.OwnerReference{}
for _, ownerRef := range allOwnerRefs {
if ownerRef.Controller != nil && *ownerRef.Controller {
ownerRefs = append(ownerRefs, ownerRef)
}
}

switch {

// Special case for endpoint. Remove after https://github.com/kubernetes/kubernetes/issues/28483 is fixed
Expand Down

0 comments on commit 7f11a50

Please sign in to comment.