Skip to content

progress

import "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/progress"

Index

type ReconcileStatus

ReconcileStatus represents the status of the current reconcile.

nil is a valid ReconcileStatus. It is safe to call all methods on a nil ReconcileStatus.

You MUST use the return value of any method which returns ReconcileStatus: the returned object may not be equal to the receiver, for example when the receiver is nil.

type ReconcileStatus = *reconcileStatus

func NeedsRefresh

func NeedsRefresh() ReconcileStatus

NeedsRefresh is a convenience method which returns a new ReconcileStatus with NeedsRefresh.

func NewReconcileStatus

func NewReconcileStatus() ReconcileStatus

NewReconcileStatus returns an empty ReconcileStatus

func WaitingOnFinalizer

func WaitingOnFinalizer(finalizer string) ReconcileStatus

WaitingOnFinalizer is a convenience method which returns a new ReconcileStatus with WaitingOnFinalizer.

func WaitingOnObject

func WaitingOnObject(kind, name string, waitingOn WaitingOnEvent) ReconcileStatus

WaitingOnObject is a convenience method which returns a new ReconcileStatus with WaitingOnObject.

func WaitingOnOpenStack

func WaitingOnOpenStack(waitingOn WaitingOnEvent, pollingPeriod time.Duration) ReconcileStatus

WaitingOnOpenStack is a convenience method which returns a new ReconcileStatus with WaitingOnOpenStack.

func WrapError

func WrapError(err error) ReconcileStatus

WrapError returns a ReconcileStatus containing the given error

func (ReconcileStatus) GetError

func (r ReconcileStatus) GetError() error

GetError returns an error representing all errors which have been added to this ReconcileStatus. If multiple errors have been added they will have been combined with errors.Join()

func (ReconcileStatus) GetProgressMessages

func (r ReconcileStatus) GetProgressMessages() []string

GetProgressMessages returns all progress messages which have been added to this ReconcileStatus

func (ReconcileStatus) GetRequeue

func (r ReconcileStatus) GetRequeue() time.Duration

GetRequeue returns the time after which the current object should be reconciled again. A value of 0 indicates that no requeue is requested.

func (ReconcileStatus) NeedsRefresh

func (r ReconcileStatus) NeedsRefresh() ReconcileStatus

NeedsRefresh indicates that the resource status needs to be refreshed. It sets an appropriate progress message and ensures that the object will be reconciled again immediately.

func (ReconcileStatus) NeedsReschedule

func (r ReconcileStatus) NeedsReschedule() (bool, error)

NeedsReschedule returns a boolean value indicating whether the ReconcileStatus will set the Progressing condition to true, and therefore that we intend to be scheduled again. It additionally returns any error associated with the ReconcileStatus.

NeedsReschedule is used to shortcut reconciliation if any precondition has not been met.

func (ReconcileStatus) Return

func (r ReconcileStatus) Return(log logr.Logger) (ctrl.Result, error)

Return returns the the (ctrl.Result, error) expected by controller-runtime for a ReconcileStatus.

If a ReconcileStatus contains a TerminalError, Return will log the error directly instead of returning it to controller-runtime, as this would cause an undesirable reschedule.

func (ReconcileStatus) WaitingOnFinalizer

func (r ReconcileStatus) WaitingOnFinalizer(finalizer string) ReconcileStatus

WaitingOnFinalizer adds a progress message indicating that we are waiting for a specific finalizer to be removed.

func (ReconcileStatus) WaitingOnObject

func (r ReconcileStatus) WaitingOnObject(kind, name string, waitingOn WaitingOnEvent) ReconcileStatus

WaitingOnObject adds a progress message indicating that we are waiting on a kubernetes object of type kind with name. We expect the controller to have an appropriate watch and handler for this event, so WaitingOnObject does not add an explicit requeue.

func (ReconcileStatus) WaitingOnOpenStack

func (r ReconcileStatus) WaitingOnOpenStack(waitingOn WaitingOnEvent, pollingPeriod time.Duration) ReconcileStatus

WaitingOnOpenStack indicates that we are waiting for an event on the current OpenStack resource. It adds an appropriate progress message. It also adds a requeue with the requested polling period, as we are not able to receive triggers for OpenStack events.

func (ReconcileStatus) WithError

func (r ReconcileStatus) WithError(err error) ReconcileStatus

WithError returns a ReconcileStatus containing the given error joined to any existing errors.

func (ReconcileStatus) WithProgressMessage

func (r ReconcileStatus) WithProgressMessage(msgs ...string) ReconcileStatus

WithProgressMessage returns a ReconcileStatus with the given progress messages in addition to any already present.

func (ReconcileStatus) WithReconcileStatus

func (r ReconcileStatus) WithReconcileStatus(o ReconcileStatus) ReconcileStatus

WithReconcileStatus returns a ReconcileStatus combining all properties of the given ReconcileStatus.

func (ReconcileStatus) WithRequeue

func (r ReconcileStatus) WithRequeue(requeue time.Duration) ReconcileStatus

WithRequeue returns a ReconcileStatus with a request to requeue after the given time. If the ReconcileStatus already requests a requeue, the returned object will have the lesser of the existing and requested requeues.

type WaitingOnEvent

WaitingOnEvent represents the type of event we are waiting on

type WaitingOnEvent int

const (
    // WaitingOnCreation indicates waiting for an object to be created
    WaitingOnCreation WaitingOnEvent = iota

    // WaitingOnReady indicates that an object exists but is not yet in the necessary state
    WaitingOnReady

    // WaitingOnDeletion indicates waiting for an object to be deleted
    WaitingOnDeletion
)

Generated by gomarkdoc