controller-runtime: EnqueueRequestForOwner creates reconcile.Request with wrong data

I might be wrong but I find the following behaviour strange.

Lets define the following:

  • Object1 -> Is created during the reconcile of Object2
  • Object2 -> Owner of Object1

I’m watching for Object2 using EnqueueRequestForObject and Object1 with EnqueueRequestForOwner. Object1 is created during the reconcile of Object2. There is a reconcile function for objects of type Object2.

In this line it is defined that the Namespace of the Object that should be reconciled is the Namespace of Object1. This means that if the Object2 is in a different Namespace than Object1 or Object1 has no Namespace at all (Object1 Type is i.e. Namespace) the Reconciler will not find the Object2.

In my case, I’m building an operator that will create Namespaces. If I delete the namespace, then the reconciler cannot find the CR which is the owner of the Namespace and the Namespace will never be recreated.

I could tweak the code to check for the CR in a specific Namespace if the reconcile.Request doesn’t contain any Namespace but I would like to know if the behaviour that I’m facing is the correct one.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

I think this can be closed – the sub-issue was fixed, and the other issue here is not possible with owner refs.