Documentation ¶
Overview ¶
Package owner implements helpers to use object Owners across clusters and namespace boundaries.
Index ¶
- Constants
- func EnqueueRequestForOwner(ownerType runtime.Object, scheme *runtime.Scheme) handler.EventHandler
- func IsOwned(object metav1.Object) (owned bool)
- func OwnedBy(owner runtime.Object, scheme *runtime.Scheme) generalizedListOption
- func ReconcileOwnedObjects(ctx context.Context, cl client.Client, log logr.Logger, scheme *runtime.Scheme, ...) (changed bool, err error)
- func RemoveOwnerReference(owner, object runtime.Object) (changed bool)
- func SetOwnerReference(owner, object runtime.Object, scheme *runtime.Scheme) (changed bool, err error)
Constants ¶
const ( // OwnerNameLabel references the name of the owner of this object. OwnerNameLabel = "owner.kubecarrier.io/name" // OwnerNamespaceLabel references the namespace of the owner of this object. OwnerNamespaceLabel = "owner.kubecarrier.io/namespace" // OwnerTypeLabel references the type of the owner of this object. OwnerTypeLabel = "owner.kubecarrier.io/type" )
Variables ¶
This section is empty.
Functions ¶
func EnqueueRequestForOwner ¶
EnqueueRequestForOwner enqueues a request for the owner of an object
func ReconcileOwnedObjects ¶
func ReconcileOwnedObjects(ctx context.Context, cl client.Client, log logr.Logger, scheme *runtime.Scheme, ownerObj runtime.Object, desired []runtime.Object, objectType runtime.Object, updateFn updateFunc) (changed bool, err error)
ReconcileOwnedObjects ensures that desired objects are up to date and other objects of the same type and owned by the same owner are removed. It works as following. We have an object, the Owner, owning multiple objects in the kubernetes cluster. And we want to ensure that after this Reconciliation of owned objects finishes the only owned objects existing are those that are wanted. Also this would only operate on the kubernetes objects objectType GroupKind. In case object already exists in the kubernetes cluster the updateFn function is called allowing the user fixing between found and wanted object. In case the function is nil it's ignored.
func RemoveOwnerReference ¶
RemoveOwnerReference removes an owner from the given object.
Types ¶
This section is empty.