reconcile

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Overview

Package reconcile provides helpers for the reconciliation. They help finalize the results of a reconciliation and also create patch helper options based on the finalized results that can be used with the patch helper during the reconciliation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPatchOptions

func AddPatchOptions(obj conditions.Setter, opts []patch.Option, ownedConditions []string, fieldOwner string) []patch.Option

AddPatchOptions adds patch options to a given patch option based on the passed conditions.Setter, ownedConditions and fieldOwner, and returns the patch options. This must be run on a kstatus compliant status. Non-kstatus compliant status may result in unexpected patch option result.

func ProgressiveStatus added in v0.25.0

func ProgressiveStatus(drift bool, obj conditions.Setter, reason, messageFormat string, messageArgs ...interface{})

ProgressiveStatus helps report the progressive status of an object based on the given status value and drift information. It always sets Reconciling=True with the given status values. Ready condition is set only when: - there's no existing Ready condition in the status - Ready=Unknown - drift is detected

Types

type Conditions

type Conditions struct {
	// Target is the target condition (e.g. Ready).
	Target string
	// Owned conditions are the conditions owned by the reconciler for this
	// target condition.
	Owned []string
	// Summarize conditions are the conditions that the target condition depends
	// on.
	Summarize []string
	// NegativePolarity conditions are the conditions in Summarize with negative
	// polarity.
	NegativePolarity []string
}

Conditions contains all the conditions information needed to summarize the target condition.

type IsResultSuccess

type IsResultSuccess func(ctrl.Result, error) bool

IsResultSuccess defines if a given ctrl.Result and error result in a successful reconciliation result.

type ResultFinalizer

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

ResultFinalizer finalizes the results of reconciliation to provide a kstatus compliant object status and appropriate runtime results based on the status observations.

func NewResultFinalizer

func NewResultFinalizer(isSuccess IsResultSuccess, readySuccessMsg string, conditions ...Conditions) *ResultFinalizer

NewResultFinalizer returns a new ResultFinalizer.

func (ResultFinalizer) Finalize

func (rs ResultFinalizer) Finalize(obj conditions.Setter, res ctrl.Result, recErr error) error

Finalize computes the result of reconciliation. It takes ctrl.Result, error from the reconciliation, and a conditions.Setter with conditions, and analyzes them to return a reconciliation error. It mutates the object status conditions based on the input to ensure the conditions are compliant with kstatus. If conditions are passed for summarization, it summarizes the status conditions such that the result is kstatus compliant. It also checks for any reconcile annotation in the object metadata and adds it to the status as LastHandledReconcileAt.

type SuccessType

type SuccessType int

SuccessType is the type of success reconciliation result for a reconciler.

const (
	// SuccessWithRequeue is the type of success result which requeues at a
	// constant period. Reconcilers of this success type reconcile on their own
	// at the period to make sure the world matches with the desired state.
	SuccessWithRequeue SuccessType = iota
	// SuccessNoRequeue is the type of success result which does not requeue.
	// Reconcilers of such success type reconcile only based on events.
	SuccessNoRequeue
)

Jump to

Keyboard shortcuts

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