owner

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package owner implements helpers to use object Owners across clusters and namespace boundaries.

Index

Constants

View Source
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

func EnqueueRequestForOwner(ownerType runtime.Object, scheme *runtime.Scheme) handler.EventHandler

EnqueueRequestForOwner enqueues a request for the owner of an object

func IsOwned

func IsOwned(object metav1.Object) (owned bool)

IsOwned checks if any owners claim ownership of this object.

func OwnedBy

func OwnedBy(owner runtime.Object, scheme *runtime.Scheme) generalizedListOption

OwnedBy returns a list filter to fetch owned objects.

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

func RemoveOwnerReference(owner, object runtime.Object) (changed bool)

RemoveOwnerReference removes an owner from the given object.

func SetOwnerReference

func SetOwnerReference(owner, object runtime.Object, scheme *runtime.Scheme) (changed bool, err error)

SetOwnerReference sets a the owner as owner of object.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL