Documentation ¶
Index ¶
- Variables
- func Handle(err error, _ context.Context) (ctrl.Result, error)
- func IsBreak(err error) bool
- func IsFlowControl(err error) bool
- func IsMarkedForDeletion(obj client.Object) bool
- func IsStopAndForget(err error) bool
- func IsStopWithRequeue(err error) bool
- func IsStopWithRequeueDelay(err error) bool
- func IsTerminal(err error) bool
- func LoadObj(ctx context.Context, state State) (error, context.Context)
- func LogErrorAndReturn(err error, msg string, result error, ctx context.Context) (error, context.Context)
- func LoggerFromCtx(ctx context.Context) logr.Logger
- func LoggerIntoCtx(ctx context.Context, logger logr.Logger) context.Context
- func MarkedForDeletionPredicate(_ context.Context, state State) bool
- func StopAndForgetAction(_ context.Context, _ State) (error, context.Context)
- func StopWithRequeueAction(_ context.Context, _ State) (error, context.Context)
- func StopWithRequeueDelay(d time.Duration) error
- type Action
- func BreakIf(predicate Predicate) Action
- func BuildBranchingAction(name string, predicate Predicate, trueAction Action, falseAction Action) Action
- func BuildSwitchAction(name string, defaultAction Action, cases ...Case) Action
- func ComposeActions(name string, actions ...Action) Action
- func StopWithRequeueDelayAction(d time.Duration) Action
- type Case
- type CaseStruct
- type FlowControlError
- type ObjWithConditions
- type ObjWithConditionsAndState
- type ObjectList
- type Predicate
- type State
- type StateCluster
- type StateFactory
- type UpdateStatusBuilder
- func (b *UpdateStatusBuilder) ErrorLogMessage(msg string) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) FailedError(err error) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) KeepConditions(conditionTypes ...string) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) OnUpdateError(f func(ctx context.Context, err error) (error, context.Context)) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) OnUpdateSuccess(f func(ctx context.Context) (error, context.Context)) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) RemoveConditionIfReasonMatched(conditionType, conditionReason string) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) RemoveConditions(conditionTypes ...string) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) Run(ctx context.Context, state State) (error, context.Context)
- func (b *UpdateStatusBuilder) SetCondition(cond metav1.Condition) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) SetExclusiveConditions(conditions ...metav1.Condition) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) SuccessError(err error) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) SuccessErrorNil() *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) SuccessLogMsg(msg string) *UpdateStatusBuilder
- func (b *UpdateStatusBuilder) UpdateErrorWrapper(f func(err error) error) *UpdateStatusBuilder
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StopAndForget error StopWithRequeue error Break error )
Functions ¶
func IsFlowControl ¶
func IsMarkedForDeletion ¶ added in v0.1.4
func IsStopAndForget ¶
func IsStopWithRequeue ¶
func IsStopWithRequeueDelay ¶
func IsTerminal ¶
func LogErrorAndReturn ¶
func StopAndForgetAction ¶
func StopWithRequeueAction ¶
func StopWithRequeueDelay ¶
Types ¶
type Action ¶
func BuildBranchingAction ¶
func BuildSwitchAction ¶
func ComposeActions ¶
type Case ¶
type CaseStruct ¶
type FlowControlError ¶
type ObjWithConditions ¶
type ObjWithConditionsAndState ¶ added in v0.1.4
type ObjWithConditionsAndState interface { ObjWithConditions State() string SetState(v string) }
type ObjectList ¶ added in v0.1.4
type ObjectList interface { client.ObjectList GetItemCount() int GetItems() []client.Object }
type State ¶
type State interface { // Cluster returns the used cluster Cluster() StateCluster // K8sClient returns the client to the cluster // // Deprecated: Use Cluster().K8sClient() instead K8sClient() client.Client // EventRecorder returns the event recorder of the connected cluster // // Deprecated: Use Cluster().EventRecorder() instead EventRecorder() record.EventRecorder // Scheme returns the Scheme // // Deprecated: Use Cluster().Scheme() instead Scheme() *runtime.Scheme Name() types.NamespacedName Obj() client.Object SetObj(client.Object) LoadObj(ctx context.Context, opts ...client.GetOption) error UpdateObj(ctx context.Context, opts ...client.UpdateOption) error UpdateObjStatus(ctx context.Context, opts ...client.SubResourceUpdateOption) error }
type StateCluster ¶
type StateCluster interface { K8sClient() client.Client ApiReader() client.Reader EventRecorder() record.EventRecorder Scheme() *runtime.Scheme }
func NewStateCluster ¶
func NewStateCluster( client client.Client, reader client.Reader, eventRecorder record.EventRecorder, scheme *runtime.Scheme, ) StateCluster
func NewStateClusterFromCluster ¶
func NewStateClusterFromCluster(cluster cluster.Cluster) StateCluster
type StateFactory ¶
type StateFactory interface {
NewState(name types.NamespacedName, obj client.Object) State
}
func NewStateFactory ¶
func NewStateFactory(cluster StateCluster) StateFactory
type UpdateStatusBuilder ¶
type UpdateStatusBuilder struct {
// contains filtered or unexported fields
}
func UpdateStatus ¶
func UpdateStatus(obj ObjWithConditions) *UpdateStatusBuilder
func (*UpdateStatusBuilder) ErrorLogMessage ¶
func (b *UpdateStatusBuilder) ErrorLogMessage(msg string) *UpdateStatusBuilder
func (*UpdateStatusBuilder) FailedError ¶
func (b *UpdateStatusBuilder) FailedError(err error) *UpdateStatusBuilder
func (*UpdateStatusBuilder) KeepConditions ¶
func (b *UpdateStatusBuilder) KeepConditions(conditionTypes ...string) *UpdateStatusBuilder
func (*UpdateStatusBuilder) OnUpdateError ¶
func (b *UpdateStatusBuilder) OnUpdateError(f func(ctx context.Context, err error) (error, context.Context)) *UpdateStatusBuilder
func (*UpdateStatusBuilder) OnUpdateSuccess ¶
func (b *UpdateStatusBuilder) OnUpdateSuccess(f func(ctx context.Context) (error, context.Context)) *UpdateStatusBuilder
func (*UpdateStatusBuilder) RemoveConditionIfReasonMatched ¶
func (b *UpdateStatusBuilder) RemoveConditionIfReasonMatched(conditionType, conditionReason string) *UpdateStatusBuilder
func (*UpdateStatusBuilder) RemoveConditions ¶
func (b *UpdateStatusBuilder) RemoveConditions(conditionTypes ...string) *UpdateStatusBuilder
func (*UpdateStatusBuilder) SetCondition ¶
func (b *UpdateStatusBuilder) SetCondition(cond metav1.Condition) *UpdateStatusBuilder
func (*UpdateStatusBuilder) SetExclusiveConditions ¶
func (b *UpdateStatusBuilder) SetExclusiveConditions(conditions ...metav1.Condition) *UpdateStatusBuilder
func (*UpdateStatusBuilder) SuccessError ¶
func (b *UpdateStatusBuilder) SuccessError(err error) *UpdateStatusBuilder
func (*UpdateStatusBuilder) SuccessErrorNil ¶
func (b *UpdateStatusBuilder) SuccessErrorNil() *UpdateStatusBuilder
func (*UpdateStatusBuilder) SuccessLogMsg ¶
func (b *UpdateStatusBuilder) SuccessLogMsg(msg string) *UpdateStatusBuilder
func (*UpdateStatusBuilder) UpdateErrorWrapper ¶
func (b *UpdateStatusBuilder) UpdateErrorWrapper(f func(err error) error) *UpdateStatusBuilder
Click to show internal directories.
Click to hide internal directories.