Many Controllers create new Kubernetes objects as part of a reconcile.
These objects are owned by the object responsible for their creation.
This relationship is recorded both in an OwnersReference in the ObjectMeta of the created objects
and through labels (on the created object) + selectors (on the created object).
The labels + selectors allow the creating controller to find all of the objects it has created,
by listing them using their label.
The OwnersReference maps the created object to its owner when there is an event for the created object.
控制器创建对应的所属关系记录在两个地方:
-
ObjectMeta中的OwnersReference中归属关系
-
metadata的label中
-
label + selector 可以让控制器找到它创建的Object
-
创建的object有Event发生时, 通过OwnersReference找到它的所有者
https://book-v1.book.kubebuilder.io/basics/what_is_a_controller.html
网友评论