Documentation ¶
Overview ¶
*
This file is intended to replace the reconciler engine file in `reconciler/engine/stepper.go` For the moment the test does not pass since a weird behaviour of the Build() function that should be fixed quickly. The Graph below is an example of LCGraph and Reconciliation states.
*
Index ¶
Constants ¶
const ( //Initial oktsm.LCGState CRChecker = iota // The entry point of a reconciliation CRFinalizer ObjectsGetter Mutator Updater ErrorManager SuccessManager GiveupManager // This special state to deal with a not alarming error (i.e. no CR available,...) or with an alarming error (implementation problem,...) End // Leaf node: End of reconciliation )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stepper ¶
Stepper is an OKT reconciler engine which reates a Reconciliation state machine. It can be used to implement an idempotent Reconcile function for an Operator Controller
Reconciliation states :
CRChecker // Check the Custom Resource received by the Controller (from the queue) ObjectsGetter // Create all OKT resources types manipulated by this Operator, register them to the OKT Reconciler Mutator // Mutates OKT resources to the desired state Updater // Create or Updates OKT resources on Cluster SuccessManager // Is reached after the Updater state in case of success Here are the debranching steps occuring on Finalization, Error, or Give-up events: CRFinalizer // The CR is being deleted and has finalizer. This stage allows you to manage your own cleanup logic. The CR update is managed at the OKT reconciler level. ErrorManager // Is reached after any step that raise an error different than GiveUpError. Just add an error in your Reconciler's results. Here is a special debranching step that is managed internaly by the Stepper, no need to handle it at your end GiveUpManager // A Terminal state. Can be reached at any time/in any state (even in SuccessManager) when an unrecoverable error happen or simply when the reconciliation can't go further for the moment
Besides that, use the "Free style" engine if you want a full control on the reconiliation process.
func NewStepper ¶
func NewStepper(hook StepperEngineHook) *Stepper
NewStepper Allocates a new reconciler Engine that will course several steps that maps a classical Reconciling process See Stepper type documentation
func (*Stepper) DisplayPathOfStates ¶
DisplayPathOfStates log the path of states
func (*Stepper) Run ¶
func (smc *Stepper) Run()
Run starts from the first reconciliation step (CRChecker). At each an action hook is called with a context parameter which is the Stepper engine itself. It stops either if an error is returned or if the "End" state is reached All results (errors, operations, ...) have to be collected in Reconciler's results (Results)data Compute next state. The principle is to generate a list of events based on watched variable (error, giveup, finalizing) and build a list of events. To be sure to go to the next step, the normal course event "DefaultState" is always added to the list.
type StepperEngineHook ¶
type StepperEngineHook interface {
EnterInState(engine *Stepper)
}
StepperEngineHook Defines the callback used by this engine at each step of the reconciliation. Step name is the state name (CRChecker, ObjectGetter, Mutator, Update, ErrorManager, SuccessManager)