state

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadyReasonError   = "Error"
	ReadyReasonPending = "Pending"
	ReadyReasonSettled = "Settled"
)
View Source
const AnnotationReapplyTimestamp = "mongodb.internal.com/reapply-timestamp"

Variables

This section is empty.

Functions

func NewReadyCondition

func NewReadyCondition(result Result) metav1.Condition

func PatchReapplyTimestamp

func PatchReapplyTimestamp(ctx context.Context, kubeClient client.Client, obj client.Object) (time.Duration, error)

func ReapplyPeriod

func ReapplyPeriod(obj metav1.Object) (time.Duration, bool, error)

func ReapplyTimestamp

func ReapplyTimestamp(obj metav1.Object) (time.Time, bool, error)

func ShouldReapply

func ShouldReapply(obj metav1.Object) (bool, error)

Types

type Reconciler

type Reconciler[T any] struct {
	// contains filtered or unexported fields
}

func NewStateReconciler

func NewStateReconciler[T any](target StateHandler[T], options ...ReconcilerOptionFn[T]) *Reconciler[T]

func (*Reconciler[T]) For

func (r *Reconciler[T]) For() (client.Object, builder.Predicates)

func (*Reconciler[T]) Reconcile

func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (reconcile.Result, error)

func (*Reconciler[T]) ReconcileState

func (r *Reconciler[T]) ReconcileState(ctx context.Context, t *T) (Result, error)

func (*Reconciler[T]) SetupWithManager

func (r *Reconciler[T]) SetupWithManager(mgr ctrl.Manager, defaultOptions controller.Options) error

type ReconcilerOptionFn

type ReconcilerOptionFn[T any] func(*Reconciler[T])

func WithCluster

func WithCluster[T any](c cluster.Cluster) ReconcilerOptionFn[T]

func WithReapplySupport

func WithReapplySupport[T any](supportReapply bool) ReconcilerOptionFn[T]

type Result

type Result struct {
	reconcile.Result
	NextState state.ResourceState
	StateMsg  string
}

type StateHandler

type StateHandler[T any] interface {
	SetupWithManager(ctrl.Manager, reconcile.Reconciler, controller.Options) error
	For() (client.Object, builder.Predicates)
	HandleInitial(context.Context, *T) (Result, error)
	HandleImportRequested(context.Context, *T) (Result, error)
	HandleImported(context.Context, *T) (Result, error)
	HandleCreating(context.Context, *T) (Result, error)
	HandleCreated(context.Context, *T) (Result, error)
	HandleUpdating(context.Context, *T) (Result, error)
	HandleUpdated(context.Context, *T) (Result, error)
	HandleDeletionRequested(context.Context, *T) (Result, error)
	HandleDeleting(context.Context, *T) (Result, error)
}

type StatusObject

type StatusObject interface {
	GetConditions() []metav1.Condition
}

type UnstructuredStateReconciler

type UnstructuredStateReconciler = StateHandler[unstructured.Unstructured]

Jump to

Keyboard shortcuts

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