You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are creating a new object, you may need a function to tie this new object to the lifecycle of the owners of the object being reconciled. For example, I have a controller that reconciles pods, which is writing secrets for the pods to use. In the case of a standalone pod, it's fine to just set the pod as an owner of this new secret using controllerutil.SetOwnerReference(). However, for pods which have an owner (ReplicaSets, DaemonSets, etc), the secret may be shared with all other related pods, as they are members of the same workload. This requires me to duplicate the logic of controllerutil.upsertOwnerRef() in my project, since I don't have the objects referred to by the pod's ownerReferences, only the references themselves and that function is not public. It would be useful in such cases to either make controllerutil.upsertOwnerRef() public, or expose that function through a new public function. If we add the ability to add an OwnerReference in this way, we should probably also add the ability to remove it as well.
The text was updated successfully, but these errors were encountered:
keeganwitt
added a commit
to keeganwitt/kubernetes-controller-runtime
that referenced
this issue
Oct 19, 2024
If you are creating a new object, you may need a function to tie this new object to the lifecycle of the owners of the object being reconciled. For example, I have a controller that reconciles pods, which is writing secrets for the pods to use. In the case of a standalone pod, it's fine to just set the pod as an owner of this new secret using
controllerutil.SetOwnerReference()
. However, for pods which have an owner (ReplicaSets, DaemonSets, etc), the secret may be shared with all other related pods, as they are members of the same workload. This requires me to duplicate the logic ofcontrollerutil.upsertOwnerRef()
in my project, since I don't have the objects referred to by the pod'sownerReferences
, only the references themselves and that function is not public. It would be useful in such cases to either makecontrollerutil.upsertOwnerRef()
public, or expose that function through a new public function. If we add the ability to add anOwnerReference
in this way, we should probably also add the ability to remove it as well.The text was updated successfully, but these errors were encountered: