utils

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RefManager

type RefManager struct {
	// contains filtered or unexported fields
}

func NewRefManager

func NewRefManager(client client.Writer, selector *metav1.LabelSelector, owner metav1.Object, schema *runtime.Scheme) (*RefManager, error)

func (*RefManager) ClaimObject

func (mgr *RefManager) ClaimObject(obj client.Object, match func(metav1.Object) bool) (bool, error)

ClaimObject tries to take ownership of an object for this controller.

It will reconcile the following:

  • Adopt orphans if the match function returns true.
  • Release owned objects if the match function returns false.

A non-nil error is returned if some form of reconciliation was attempted and failed. Usually, controllers should try again later in case reconciliation is still needed.

If the error is nil, either the reconciliation succeeded, or no reconciliation was necessary. The returned boolean indicates whether you now own the object.

No reconciliation will be attempted if the controller is being deleted.

func (*RefManager) ClaimOwned

func (mgr *RefManager) ClaimOwned(objs []client.Object) ([]client.Object, error)

func (*RefManager) Release added in v0.3.0

func (mgr *RefManager) Release(obj client.Object) error

Jump to

Keyboard shortcuts

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