Documentation
¶
Index ¶
- Constants
- func ComputeStateTracker(obj metav1.Object, dependencies ...client.Object) string
- func GetExternalID(obj metav1.Object) (string, error)
- func NewReadyCondition(result Result) metav1.Condition
- func PatchReapplyTimestamp(ctx context.Context, kubeClient client.Client, obj client.Object) (time.Duration, error)
- func ReapplyPeriod(obj metav1.Object) (time.Duration, bool, error)
- func ReapplyTimestamp(obj metav1.Object) (time.Time, bool, error)
- func ShouldReapply(obj metav1.Object) (bool, error)
- func ShouldUpdate(obj metav1.Object, dependencies ...client.Object) (bool, error)
- type ControllerSetupBuilder
- type Patcher
- func (p *Patcher) Patch(ctx context.Context, c client.Client) error
- func (p *Patcher) UpdateConditions(conditions []metav1.Condition) *Patcher
- func (p *Patcher) UpdateStateTracker(dependencies ...client.Object) *Patcher
- func (p *Patcher) UpdateStatus() *Patcher
- func (p *Patcher) WithFieldOwner(fieldOwner string) *Patcher
- type Reconciler
- func (r *Reconciler[T]) For() (client.Object, builder.Predicates)
- func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (reconcile.Result, error)
- func (r *Reconciler[T]) ReconcileState(ctx context.Context, t *T) (Result, error)
- func (r *Reconciler[T]) SetupWithManager(mgr ctrl.Manager, defaultOptions controller.Options) error
- type ReconcilerOptionFn
- type Result
- type StateHandler
- type StatusObject
- type UnstructuredStateReconciler
Constants ¶
const ( AnnotationReapplyTimestamp = "mongodb.internal.com/reapply-timestamp" AnnotationStateTracker = "mongodb.internal.com/state-tracker" AnnotationExternalID = "mongodb.com/external-id" )
const ( ReadyReasonError = "Error" ReadyReasonPending = "Pending" ReadyReasonSettled = "Settled" )
const FieldOwner = "mongodb-atlas-kubernetes-resource-handler"
Variables ¶
This section is empty.
Functions ¶
func ComputeStateTracker ¶
func GetExternalID ¶
GetExternalID reads the AnnotationExternalID annotation from obj. Returns an error if the annotation is absent or empty.
func NewReadyCondition ¶
func PatchReapplyTimestamp ¶
func ShouldUpdate ¶
ShouldUpdate returns true if the object should be updated based on generation change, reapply period, or error status. Note: a generation change or error status will only be detected if the object implements StatusObject interface.
Returns an error if there is an issue checking the reapply period.
Types ¶
type ControllerSetupBuilder ¶
type ControllerSetupBuilder = ctrlrtbuilder.TypedBuilder[reconcile.Request]
type Patcher ¶
type Patcher struct {
// contains filtered or unexported fields
}
func NewPatcher ¶
func (*Patcher) Patch ¶
Patch applies the patches to the given object and updates both status and the annotations if they were modified.
func (*Patcher) UpdateConditions ¶
UpdateConditions updates the status conditions of the given object.
Note: this method only updates the "conditions" field in the status. To update remaining status fields, use UpdateStatus().
func (*Patcher) UpdateStateTracker ¶
UpdateStateTracker updates the state tracker annotation on the given object.
func (*Patcher) UpdateStatus ¶
UpdateStatus updates the status of the given object.
Note: this method omits the "conditions" field from the status. To update conditions, use UpdateConditions().
func (*Patcher) WithFieldOwner ¶
WithFieldOwner sets the field owner for the patch operation.
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]) 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 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 UnstructuredStateReconciler ¶
type UnstructuredStateReconciler = StateHandler[unstructured.Unstructured]