reconciler

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConditionTypeReady represents the status of the Deployment reconciliation.
	ConditionTypeReady = "Ready"
	// ConditionTypeDeleted represents the status used when the custom resource is deleted and the finalizer
	// operations are must to occur.
	ConditionTypeDeleted = "Deleted"
)
View Source
var (
	ConditionReasonReconciling = "Reconciling"
	ConditionReasonReconciled  = "Reconciled"
	ConditionReasonDeleting    = "Deleting"
	ConditionReasonFinalizing  = "Finalizing"
)
View Source
var (
	MessageReconciliationInProcess = "Reconciliation in process"
	MessageReconciliationCompleted = "Reconciliation completed"
)
View Source
var ErrorUpdatingStatus = "Failed to update resource status"

Functions

func ContinueReconciling

func ContinueReconciling() (*reconcile.Result, error)

ContinueReconciling indicates that the reconciliation block should continue by returning a nil result and a nil error.

func DoNotRequeue

func DoNotRequeue() (*reconcile.Result, error)

DoNotRequeue returns a controller result pairing specifying not to requeue.

func Evaluate

func Evaluate(r *reconcile.Result, e error) (reconcile.Result, error)

Evaluate returns the actual reconcile struct and error. Wrap helpers in this when returning from within the top-level Reconciler.

func Requeue

func Requeue() (*reconcile.Result, error)

Requeue returns a controller result pairing specifying to requeue with no error message implied. This returns no error.

func RequeueAfter

func RequeueAfter(after time.Duration) (*reconcile.Result, error)

RequeueAfter returns a controller result pairing specifying to requeue after the given time.

func RequeueWithError

func RequeueWithError(e error) (*reconcile.Result, error)

RequeueWithError returns a controller result pairing specifying to requeue with an error message.

func ShouldHaltOrRequeue

func ShouldHaltOrRequeue(r *ctrl.Result, err error) bool

ShouldHaltOrRequeue returns true if reconciler result is not nil or the err is not nil. In theory, the error evaluation is not needed because ShouldRequeue handles it, but it's included in case ShouldHaltOrRequeue is called directly.

func ShouldRequeue

func ShouldRequeue(r *ctrl.Result, err error) bool

ShouldRequeue returns true if the reconciler result indicates a requeue is required, or the error is not nil.

Types

type BaseSubreconciler

type BaseSubreconciler[S v1.Resource] struct {
	client.Client
	Manager  manager.Manager
	Config   Config
	Recorder record.EventRecorder
	Tracer   trace.Tracer
	Scheme   *runtime.Scheme
}

func (*BaseSubreconciler[S]) RecordEvent

func (r *BaseSubreconciler[S]) RecordEvent(obj S, reason string, msg string, args ...interface{})

func (*BaseSubreconciler[S]) SetConditionMessageByType

func (r *BaseSubreconciler[S]) SetConditionMessageByType(ctx context.Context, obj S, conditionType, msg string) error

func (BaseSubreconciler[S]) SetDeletingMessage

func (r BaseSubreconciler[S]) SetDeletingMessage(ctx context.Context, obj S, msg string) error

func (BaseSubreconciler[S]) SetReconcilingMessage

func (r BaseSubreconciler[S]) SetReconcilingMessage(ctx context.Context, obj S, msg string) error

func (BaseSubreconciler[S]) SetState

func (r BaseSubreconciler[S]) SetState(ctx context.Context, obj S, state v1.PhaseCode) error

type Config

type Config struct {
	Timeout          *time.Duration                                `mapstructure:"timeout,omitempty" `
	RequeueDelayTime []time.Duration                               `mapstructure:"requeueDelayTime,omitempty"`
	MaxConditions    int                                           `mapstructure:"maxConditions,omitempty"`
	Meta             map[string]any                                `mapstructure:"meta,omitempty"`
	Providers        map[provider.GroupID]provider.ProvidersConfig `mapstructure:"providers,omitempty"`
}

func (*Config) GetRequeueTimeForAttempt

func (c *Config) GetRequeueTimeForAttempt(attempt int) time.Duration

type Reconciler

type Reconciler[S v1.Resource] interface {
	Reconcile(ctx context.Context, req ctrl.Request, obj S) (ctrl.Result, error)
}

func New

func New[S v1.Resource](id string, mgr manager.Manager, finalizerName string,
	config Config, subreconciler Subreconciler[S],
) Reconciler[S]

type Subreconciler

type Subreconciler[S v1.Resource] interface {
	HandleReconciliation(ctx context.Context, obj S) (*ctrl.Result, error)
	HandleDeletion(ctx context.Context, obj S) (*ctrl.Result, error)
}

Jump to

Keyboard shortcuts

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