如何正确连接K8S对象?

How to correctly connect K8S objects?

根据 operator-sdk doc 这是算子开发者常犯的错误。

Methods for connecting Kubernetes objects through labels, OwnerRefs, status etc that may be incompatible with future updates or too restrictive in the long term.

那什么是正确的方法呢? 如何在没有 labelsOwnerRefs 的情况下连接相关对象?

该文档可能很快就会被删除,这里有一个维护的最佳实践文档:https://github.com/operator-framework/community-operators/blob/master/docs/best-practices.md

使用标签和 ownerRefs 是连接相关资源的好方法(我们甚至为基于 Ansible 的 Operators 强制执行 ownerRefs),所以我会忽略该指导。