Documentation ¶
Index ¶
- func ContextFromStopChannel(stopCh <-chan struct{}) context.Context
- func DeleteFinalizer(ctx context.Context, c client.Client, finalizerName string, ...) error
- func EnsureFinalizer(ctx context.Context, c client.Client, finalizerName string, ...) error
- func EvalGenericPredicate(obj runtime.Object, predicates ...predicate.Predicate) bool
- func NewErrorFormatFuncWithPrefix(prefix string) multierror.ErrorFormatFunc
- func NewGenericEvent(meta metav1.Object, obj runtime.Object) event.GenericEvent
- func NewGenericEventFromObject(obj runtime.Object) event.GenericEvent
- func TryUpdate(ctx context.Context, backoff wait.Backoff, c client.Client, obj runtime.Object, ...) error
- func TryUpdateStatus(ctx context.Context, backoff wait.Backoff, c client.Client, obj runtime.Object, ...) error
- func TypedCreateOrUpdate(ctx context.Context, c client.Client, scheme *runtime.Scheme, ...) (controllerutil.OperationResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextFromStopChannel ¶ added in v0.13.0
ContextFromStopChannel creates a new context from a given stop channel.
func DeleteFinalizer ¶
func DeleteFinalizer(ctx context.Context, c client.Client, finalizerName string, obj controllerutil.Object) error
DeleteFinalizer ensures that the given finalizer is not present anymore in the given object. If it is set, it removes it and issues an update.
func EnsureFinalizer ¶
func EnsureFinalizer(ctx context.Context, c client.Client, finalizerName string, obj controllerutil.Object) error
EnsureFinalizer ensures that a finalizer of the given name is set on the given object. If the finalizer is not set, it adds it to the list of finalizers and updates the remote object.
func EvalGenericPredicate ¶
EvalGenericPredicate returns true if all predicates match for the given object.
func NewErrorFormatFuncWithPrefix ¶ added in v0.13.0
func NewErrorFormatFuncWithPrefix(prefix string) multierror.ErrorFormatFunc
NewErrorFormatFuncWithPrefix creates a new multierror.ErrorFormatFunc which can be used as an ErrorFormat on multierror.Error instances. The error string is prefixed with <prefix>, all errors are concatenated at the end. This is similar to multierror.ListFormatFunc but does not use any escape sequences, which will look weird in the status of Kubernetes objects or controller logs.
func NewGenericEvent ¶
NewGenericEvent creates a new GenericEvent from the given metav1.Object and runtime.Object.
func NewGenericEventFromObject ¶
func NewGenericEventFromObject(obj runtime.Object) event.GenericEvent
NewGenericEventFromObject creates a new GenericEvent from the given runtime.Object.
It tries to extract a metav1.Object from the given Object. If it fails, the Meta of the resulting GenericEvent will be `nil`.
func TryUpdate ¶
func TryUpdate(ctx context.Context, backoff wait.Backoff, c client.Client, obj runtime.Object, transform func() error) error
TryUpdate tries to apply the given transformation function onto the given object, and to update it afterwards. It retries the update with an exponential backoff.
func TryUpdateStatus ¶
func TryUpdateStatus(ctx context.Context, backoff wait.Backoff, c client.Client, obj runtime.Object, transform func() error) error
TryUpdateStatus tries to apply the given transformation function onto the given object, and to update its status afterwards. It retries the status update with an exponential backoff.
func TypedCreateOrUpdate ¶ added in v0.13.0
func TypedCreateOrUpdate(ctx context.Context, c client.Client, scheme *runtime.Scheme, obj *unstructured.Unstructured, alwaysUpdate bool, mutate func() error) (controllerutil.OperationResult, error)
TypedCreateOrUpdate is like controllerutil.CreateOrUpdate, it retrieves the current state of the object from the API server, applies the given mutate func and creates or updates it afterwards. In contrast to controllerutil.CreateOrUpdate it tries to create a new typed object of obj's kind (using the provided scheme) to make typed Get requests in order to leverage the client's cache.
Types ¶
This section is empty.