Skip to content

Commit

Permalink
chore: remove some unused code and update some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hrak committed Aug 12, 2024
1 parent 0cb485c commit 526fff9
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions controllers/utils/base_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,6 @@ func (r *ReconciliationRunner) SetupPatcher() (res ctrl.Result, retErr error) {
return res, errors.Wrapf(retErr, "setting up patcher")
}

// PatchChangesBackToAPI patches changes to the ReconciliationSubject back to the appropriate API.
func (r *ReconciliationRunner) PatchChangesBackToAPI() (res ctrl.Result, retErr error) {
r.Log.V(1).Info("Patching changes back to api.")
err := r.Patcher.Patch(r.RequestCtx, r.ReconciliationSubject)
return res, errors.Wrapf(err, "patching reconciliation subject")
}

// RequeueWithMessage is a convenience method to log requeue message and then return a result with RequeueAfter set.
func (r *ReconciliationRunner) RequeueWithMessage(msg string, keysAndValues ...interface{}) (ctrl.Result, error) {
// Add requeuing to message if not present. Might turn this into a lint check later.
Expand All @@ -350,17 +343,12 @@ func (r *ReconciliationRunner) ReturnWrappedError(err error, msg string) (ctrl.R
return ctrl.Result{}, errors.Wrap(err, msg)
}

func (r *ReconciliationRunner) LogReconciliationSubject() (ctrl.Result, error) {
r.Log.Info("The subject", "subject", r.ReconciliationSubject)
return ctrl.Result{}, nil
}

// CloudStackReconcilerMethod is the method type used in RunReconciliationStages. Additional arguments can be added
// by wrapping this type in another function affectively currying them.
type CloudStackReconcilerMethod func() (ctrl.Result, error)

// RunReconciliationStage runs a CloudStackReconcilerMethod and returns a boolean to indicate whether that stage would
// have returned a result that cuts the process short or not.
// ShouldReturn returns a boolean to indicate whether a CloudStackReconcilerMethod returned a result that should cut the
// reconciliation process short or not.
func (r *ReconciliationRunner) ShouldReturn(rslt ctrl.Result, err error) bool {
if err != nil {
return true
Expand Down Expand Up @@ -429,7 +417,7 @@ func (r *ReconciliationRunner) SetReturnEarly() {
r.returnEarly = true
}

// GetReconcilationSubject gets the reconciliation subject of type defined by the concrete reconciler. It also sets up
// GetReconciliationSubject gets the reconciliation subject of type defined by the concrete reconciler. It also sets up
// a patch helper at this point.
func (r *ReconciliationRunner) GetReconciliationSubject() (res ctrl.Result, reterr error) {
r.Log.V(1).Info("Getting reconciliation subject.")
Expand Down

0 comments on commit 526fff9

Please sign in to comment.