Documentation ¶
Index ¶
- Constants
- Variables
- func AddNonBlockingOwner(object metav1.Object, owner Owner)
- func AddOwner(object metav1.Object, owner Owner, blockOwnerDeletion, isController bool)
- func AddOwnerLabels(object metav1.Object, owner Owner) error
- func AddOwnerLabelsForKind(object metav1.Object, owner Owner, kind string)
- func Adoptable(target Owner, owners []metav1.OwnerReference) bool
- func AdoptableLabels(labels map[string]string, checkName bool, targets ...Owner) bool
- func CSVOwnerSelector(owner *operatorsv1alpha1.ClusterServiceVersion) labels.Selector
- func EnsureOwner(object metav1.Object, owner Owner) bool
- func GetOwnerByKind(object metav1.Object, ownerKind string) *metav1.OwnerReference
- func GetOwnerByKindLabel(object metav1.Object, ownerKind string) (name, namespace string, ok bool)
- func GetOwnersByKind(object metav1.Object, ownerKind string) []metav1.OwnerReference
- func HasOwnerConflict(target Owner, owners []metav1.OwnerReference) bool
- func InferGroupVersionKind(obj runtime.Object) error
- func IsOwnedBy(object metav1.Object, owner Owner) bool
- func IsOwnedByKind(object metav1.Object, ownerKind string) bool
- func IsOwnedByKindLabel(object metav1.Object, ownerKind string) bool
- func IsOwnedByLabel(object metav1.Object, owner Owner) bool
- func NonBlockingOwner(owner Owner) metav1.OwnerReference
- func NonBlockingOwnerApplyConfiguration(owner Owner) *metav1ac.OwnerReferenceApplyConfiguration
- func OwnerLabel(owner Owner, kind string) map[string]string
- type Owner
Constants ¶
const ( OwnerKey = "olm.owner" OwnerNamespaceKey = "olm.owner.namespace" OwnerKind = "olm.owner.kind" )
Variables ¶
var ( NotController = false DontBlockOwnerDeletion = false )
Functions ¶
func AddNonBlockingOwner ¶
AddNonBlockingOwner adds a nonblocking owner to the ownerref list.
func AddOwnerLabels ¶
AddOwnerLabels adds ownerref-like labels to an object by inferring the owner kind
func AddOwnerLabelsForKind ¶
AddOwnerLabels adds ownerref-like labels to an object, with no inference
func Adoptable ¶
func Adoptable(target Owner, owners []metav1.OwnerReference) bool
Adoptable checks whether a resource with the given set of OwnerReferences is "adoptable" by the target OwnerReference. This function returns true if there exists an element in owners referencing the same kind target does, otherwise it returns false.
func AdoptableLabels ¶
AdoptableLabels determines if an OLM managed resource is adoptable by any of the given targets based on its owner labels. The checkName perimeter enables an additional check for name equality with the `olm.owner` label. Generally used for cross-namespace ownership and for Cluster -> Namespace scope.
func CSVOwnerSelector ¶
func CSVOwnerSelector(owner *operatorsv1alpha1.ClusterServiceVersion) labels.Selector
CSVOwnerSelector returns a label selector to find generated objects owned by owner
func EnsureOwner ¶
EnsureOwner adds a new owner if needed and returns whether the object already had the owner.
func GetOwnerByKind ¶
func GetOwnerByKind(object metav1.Object, ownerKind string) *metav1.OwnerReference
func GetOwnerByKindLabel ¶
func GetOwnersByKind ¶
func GetOwnersByKind(object metav1.Object, ownerKind string) []metav1.OwnerReference
GetOwnersByKind returns all OwnerReferences of the given kind listed by the given object
func HasOwnerConflict ¶
func HasOwnerConflict(target Owner, owners []metav1.OwnerReference) bool
HasOwnerConflict checks if the given list of OwnerReferences points to owners other than the target. This function returns true if the list of OwnerReferences is empty or contains elements of the same kind as the target but does not include the target OwnerReference itself. This function returns false if the list contains the target, or has no elements of the same kind as the target.
Note: This is imporant when determining if a Role, RoleBinding, ClusterRole, or ClusterRoleBinding can be used to satisfy permissions of a CSV. If the target CSV is not a member of the RBAC resource's OwnerReferences, then we know the resource can be garbage collected by OLM independently of the target CSV
func InferGroupVersionKind ¶
InferGroupVersionKind adds TypeMeta to an owner so that it can be written to an ownerref. TypeMeta is generally only known at serialization time, so we often won't know what GVK an owner has. For the types we know about, we can add the GVK of the apis that we're using the interact with the object.
func IsOwnedByKindLabel ¶
IsOwnedByKindLabel returns whether or not a label exists on the object pointing to an owner of a particular kind
func NonBlockingOwner ¶
func NonBlockingOwner(owner Owner) metav1.OwnerReference
NonBlockingOwner returns an ownerrefence to be added to an ownerref list
func NonBlockingOwnerApplyConfiguration ¶ added in v0.28.0
func NonBlockingOwnerApplyConfiguration(owner Owner) *metav1ac.OwnerReferenceApplyConfiguration
NonBlockingOwnerApplyConfiguration returns an ownerrefence to be added to an ownerref list used in an SSA Configuration