Documentation ¶
Index ¶
- type PlantReconciler
- func (r *PlantReconciler) ErrorHandle(ctx context.Context, plant *apiv1.Plant, err error) (ctrl.Result, error)
- func (r *PlantReconciler) HandleDeletingState(ctx context.Context, plant *apiv1.Plant) (bool, error)
- func (r *PlantReconciler) HandleProcessingState(ctx context.Context, plant *apiv1.Plant) (bool, error)
- func (r *PlantReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *PlantReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *PlantReconciler) StateHandle(ctx context.Context, plant *apiv1.Plant) (bool, error)
- func (r *PlantReconciler) UpdateResults(ctx context.Context, plant *apiv1.Plant, results []resource.ExecuteResult) error
- func (r *PlantReconciler) UpdateStatus(ctx context.Context, plant *apiv1.Plant, opts ...func(*apiv1.Plant)) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PlantReconciler ¶
type PlantReconciler struct { Client client.Client // differentiate Client and PlantReconciler calls Scheme *runtime.Scheme Workflow workflow.Manager Recorder record.EventRecorder }
PlantReconciler reconciles a Plant object
func (*PlantReconciler) ErrorHandle ¶
func (r *PlantReconciler) ErrorHandle(ctx context.Context, plant *apiv1.Plant, err error) (ctrl.Result, error)
ErrorHandle logs the error, puts Plant into apiv1.StateError state, and returns rescheduled result.
func (*PlantReconciler) HandleDeletingState ¶
func (r *PlantReconciler) HandleDeletingState(ctx context.Context, plant *apiv1.Plant) (bool, error)
HandleDeletingState remove all hanging resources. The garbage collector will handle internal resource deletion, while we handle the external ones here.
func (*PlantReconciler) HandleProcessingState ¶
func (r *PlantReconciler) HandleProcessingState(ctx context.Context, plant *apiv1.Plant) (bool, error)
HandleProcessingState processes all child resources by ensuring that they are in proper states. Check runHandler to get more details on how child resource execution is handled. Returns true if reconcile should be triggered. Updates Status with observed results.
func (*PlantReconciler) Reconcile ¶
Reconcile ensures that Plant and its owned resources match the required states from the cluster. This method will fetch the controlled Plant object, ensure that Plant has Finalizers and required states to safely address deletion, and finally, invoke StateHandle to perform control tasks based on the requirements. Reconcile relies on StateHandle to handle the request, and ErrorHandle to handle the errors. Request will be rescheduled if an error occurs.
func (*PlantReconciler) SetupWithManager ¶
func (r *PlantReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
func (*PlantReconciler) StateHandle ¶
StateHandle runs the main control loop based on the configured Plant state. Returns true if reconcile should be triggered.
func (*PlantReconciler) UpdateResults ¶
func (r *PlantReconciler) UpdateResults(ctx context.Context, plant *apiv1.Plant, results []resource.ExecuteResult) error
UpdateResults will handle results from executions by adding them to Plant status
func (*PlantReconciler) UpdateStatus ¶
func (r *PlantReconciler) UpdateStatus(ctx context.Context, plant *apiv1.Plant, opts ...func(*apiv1.Plant)) error
UpdateStatus will update plants status using provided values and options.