Documentation ¶
Index ¶
- Constants
- func CheckReadyPhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
- func CompletePhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
- func CreateOrUpdate(r workload.Reconciler, req *workload.Request, resource client.Object) error
- func CreateResourcesPhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
- func DeletionCompletePhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
- func DependencyPhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
- func HandleResourcePhaseExit(resourceCreated bool, resourceErr error) (status.ChildResourceCondition, bool, error)
- func IsOptimisticLockError(err error) bool
- func RegisterDeleteHooks(r workload.Reconciler, req *workload.Request) error
- func UpdateResourceConditions(r workload.Reconciler, req *workload.Request, resource *status.ChildResource) error
- type HandlerFunc
- type LifecycleEvent
- type Phase
- type PhaseOption
- type Registry
- func (registry *Registry) Execute(r workload.Reconciler, req *workload.Request, event LifecycleEvent) (reconcile.Result, error)
- func (registry *Registry) HandleExecution(r workload.Reconciler, req *workload.Request) (reconcile.Result, error)
- func (registry *Registry) Register(name string, definition HandlerFunc, event LifecycleEvent, ...)
- type ResourceOption
Constants ¶
const (
ResourceOptionWithWait = iota
)
Variables ¶
This section is empty.
Functions ¶
func CheckReadyPhase ¶
func CheckReadyPhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
CheckReadyPhase executes checking for a parent component's readiness status.
func CompletePhase ¶
func CompletePhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
CompletePhase executes the completion of a reconciliation loop.
func CreateOrUpdate ¶
CreateOrUpdate creates a resource if it does not already exist or updates a resource if it does already exist.
func CreateResourcesPhase ¶
func CreateResourcesPhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
CreateResourcesPhase creates or updated the child resources of a workload during a reconciliation loop.
func DeletionCompletePhase ¶
func DeletionCompletePhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
DeletionCompletePhase executes the completion of a reconciliation loop for a delete request.
func DependencyPhase ¶
func DependencyPhase(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (bool, error)
DependencyPhase executes a dependency check prior to attempting to create resources.
func HandleResourcePhaseExit ¶
func HandleResourcePhaseExit( resourceCreated bool, resourceErr error, ) (status.ChildResourceCondition, bool, error)
HandleResourcePhaseExit will generate the appropriate resource condition for a resource creation event.
func IsOptimisticLockError ¶
IsOptimisticLockError checks to see if the error is a locking error.
func RegisterDeleteHooks ¶
func RegisterDeleteHooks(r workload.Reconciler, req *workload.Request) error
RegisterDeleteHooks add finializers to the workload resources so that the delete lifecycle can be run beofre the object is deleted.
func UpdateResourceConditions ¶
func UpdateResourceConditions( r workload.Reconciler, req *workload.Request, resource *status.ChildResource, ) error
UpdateResourceConditions updates the status.resourceConditions field of the parent custom resource.
Types ¶
type HandlerFunc ¶
type HandlerFunc func(r workload.Reconciler, req *workload.Request, options ...ResourceOption) (proceed bool, err error)
HandlerFunc is an adapter to allow the use of ordinary functions as reconcile phases. If the function has the appropriate signature, it will considered a valid phase handler.
type LifecycleEvent ¶
type LifecycleEvent int32
LifecycleEvent is used to convey which lifecycle event we are targeting.
const ( CreateEvent LifecycleEvent = iota UpdateEvent DeleteEvent )
type Phase ¶
type Phase struct { Name string // contains filtered or unexported fields }
Phase defines a phase of the reconciliation process.
func (*Phase) DefaultReconcileResult ¶
DefaultReconcileResult will return the default reconcile result when requeuing is not needed.
type PhaseOption ¶
type PhaseOption func(*Phase)
PhaseOption is a function pattern to allow customization of a phase upon registration.
func WithCustomRequeueResult ¶
func WithCustomRequeueResult(requeueResult ctrl.Result) PhaseOption
WithCustomRequeueResult allows you to define a custom result for a phase when it is requeued, this allows for custom requeue time backoffs.
func WithResourceOptions ¶ added in v0.5.0
func WithResourceOptions(options ...ResourceOption) PhaseOption
WithResourceOptions adds the requested resource options to the phase.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a store for all the phases for each event loop.
func (*Registry) Execute ¶
func (registry *Registry) Execute(r workload.Reconciler, req *workload.Request, event LifecycleEvent) (reconcile.Result, error)
Execute runs the phases for the specified lifecycle event.
func (*Registry) HandleExecution ¶
func (registry *Registry) HandleExecution(r workload.Reconciler, req *workload.Request) (reconcile.Result, error)
HandleExecution will trigger the execution of the phases for the appropriate lifecycle event. This is the main entrypoint into our phases.
func (*Registry) Register ¶
func (registry *Registry) Register(name string, definition HandlerFunc, event LifecycleEvent, options ...PhaseOption)
Register is used to add a Phase to the Registry for the provided event loop.
type ResourceOption ¶ added in v0.5.0
type ResourceOption int
ResourceOption is a pattern to allow customization to the resource deployment process.