finalizer

package
v0.0.0-...-0e4f5d7 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessFinalizers

func ProcessFinalizers(ctx context.Context, client client.Client, reader client.Reader, recorder record.EventRecorder, obj runtime.Object, finalizers []Finalizer) (reconcile.Result, error)

The function will process finalizers of the object.

If the deletion timestamp is nil, then it will add all names of all missing finalizers, and update the object if this caused a change.

If the deletion timestamp is non-nil, it will iterate over the finalizers, and call the destructor for the first finalizer it still finds in the list (in any order). If the deconstructor returns as "finished", then will remove the finalizer from the list, and request to be re-queued.

**Note:** When the function requests to be re-queue, the object's finalizer list was changed, and this change must be persisted by the caller!

Types

type DeconstructorContext

type DeconstructorContext struct {
	Context  context.Context
	Client   client.Client
	Reader   client.Reader
	Object   runtime.Object
	Recorder record.EventRecorder
}

type Finalizer

type Finalizer struct {
	// the name of the finalizer
	Name string

	// The deconstructor function, which will be called when the finalizer
	// is still present on the object, and the deletion timestamp is set.
	// When the deconstructor is finished, or had nothing to do, it must return
	// a nil error, and a result which does not request a requeue.
	//
	// If the error is non-nil, or a requeue was requested, the finalizer will
	// *not* be removed from the list.
	Deconstruct func(ctx DeconstructorContext) (reconcile.Result, error)
}

Jump to

Keyboard shortcuts

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