According to the operator-sdk doc This is a common mistake made by operator developers.
Methods for connecting Kubernetes objects through labels, OwnerRefs, status etc that may be incompatible with future updates or too restrictive in the long term.
What is the right way then?
How to connect related objects whithout labels
and OwnerRefs
?
That document is likely going to be removed soon, there's a maintained best practices document here: https://github.com/operator-framework/community-operators/blob/master/docs/best-practices.md
Using labels and ownerRefs is a good way to connect related resources (we even enforce ownerRefs for Ansible-based Operators), so I would ignore that guidance.