reconcile

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeReconcileResult

func ComputeReconcileResult(obj conditions.Setter, res Result, recErr error, rb RuntimeResultBuilder) ([]patch.Option, ctrl.Result, error)

ComputeReconcileResult analyzes the reconcile results (result + error), updates the status conditions of the object with any corrections and returns object patch configuration, runtime result and runtime error. The caller is responsible for using the patch configuration while patching the object in the API server. The RuntimeResultBuilder is used to define how the ctrl.Result is computed.

func FailureRecovery added in v0.23.0

func FailureRecovery(oldObj, newObj conditions.Getter, failConditions []string) bool

FailureRecovery finds out if a failure recovery occurred by checking the fail conditions in the old object and the new object.

Types

type AlwaysRequeueResultBuilder

type AlwaysRequeueResultBuilder struct {
	// RequeueAfter is the fixed period at which the reconciler requeues on
	// successful execution.
	RequeueAfter time.Duration
}

AlwaysRequeueResultBuilder implements a RuntimeResultBuilder for always requeuing reconcilers. A successful reconciliation result for such reconcilers contains a fixed RequeueAfter value.

func (AlwaysRequeueResultBuilder) BuildRuntimeResult

func (r AlwaysRequeueResultBuilder) BuildRuntimeResult(rr Result, err error) ctrl.Result

BuildRuntimeResult converts a given Result and error into the return values of a controller's Reconcile function.

func (AlwaysRequeueResultBuilder) IsSuccess added in v0.24.4

func (r AlwaysRequeueResultBuilder) IsSuccess(result ctrl.Result) bool

IsSuccess returns true if the given Result has the same RequeueAfter value as of the AlwaysRequeueResultBuilder.

type Result

type Result int

Result is a type for creating an abstraction for the controller-runtime reconcile Result to simplify the Result values.

const (
	// ResultEmpty indicates a reconcile result which does not requeue. It is
	// also used when returning an error, since the error overshadows result.
	ResultEmpty Result = iota
	// ResultRequeue indicates a reconcile result which should immediately
	// requeue.
	ResultRequeue
	// ResultSuccess indicates a reconcile success result.
	// For a reconciler that requeues regularly at a fixed interval, runtime
	// result with a fixed RequeueAfter is success result.
	// For a reconciler that doesn't requeue on successful reconciliation,
	// an empty runtime result is success result.
	// It is usually returned at the end of a reconciler/sub-reconciler.
	ResultSuccess
)

func LowestRequeuingResult

func LowestRequeuingResult(i, j Result) Result

LowestRequeuingResult returns the ReconcileResult with the lowest requeue period. Weightage:

ResultRequeue - immediate requeue (lowest)
ResultSuccess - requeue at an interval
ResultEmpty - no requeue

type RuntimeResultBuilder

type RuntimeResultBuilder interface {
	// BuildRuntimeResult analyzes the result and error to return a runtime
	// result.
	BuildRuntimeResult(rr Result, err error) ctrl.Result
	// IsSuccess returns if a given runtime result is success for a
	// RuntimeResultBuilder.
	IsSuccess(ctrl.Result) bool
}

RuntimeResultBuilder defines an interface for runtime result builders. This can be implemented to build custom results based on the context of the reconciler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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