Skip to content

Commit

Permalink
Remote useless reconciliation methods
Browse files Browse the repository at this point in the history
There are a number of placeholder reconciliation method that do nothing
except logging messages of how the method has been entered and exited.

This is useless code as well as clutter in the logs, so this patch
removes them.

Affected methods are:

- reconcileInit
- reconcileUpdate
- reconcileUpgrade

There are instances where reconcileInit is actually doing things, and in
those cases methods were left untouched.
  • Loading branch information
Akrog authored and ASBishop committed Oct 30, 2024
1 parent 43b2a1b commit 84ec098
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 260 deletions.
40 changes: 0 additions & 40 deletions controllers/cinder_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,22 +656,6 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder
return ctrlResult, nil
}

// Handle service update
ctrlResult, err = r.reconcileUpdate(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

// Handle service upgrade
ctrlResult, err = r.reconcileUpgrade(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

//
// normal reconcile tasks
//
Expand Down Expand Up @@ -866,30 +850,6 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder
return ctrl.Result{}, nil
}

func (r *CinderReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.Cinder) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name))

// TODO: should have minor update tasks if required
// - delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name))
return ctrl.Result{}, nil
}

func (r *CinderReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.Cinder) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name))

// TODO: should have major version upgrade tasks
// -delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name))
return ctrl.Result{}, nil
}

// generateServiceConfigs - create Secret which hold scripts and service configuration
func (r *CinderReconciler) generateServiceConfigs(
ctx context.Context,
Expand Down
40 changes: 0 additions & 40 deletions controllers/cinderapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,22 +821,6 @@ func (r *CinderAPIReconciler) reconcileNormal(ctx context.Context, instance *cin
return ctrlResult, nil
}

// Handle service update
ctrlResult, err = r.reconcileUpdate(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

// Handle service upgrade
ctrlResult, err = r.reconcileUpgrade(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

//
// normal reconcile tasks
//
Expand Down Expand Up @@ -984,30 +968,6 @@ func (r *CinderAPIReconciler) reconcileNormal(ctx context.Context, instance *cin
return ctrl.Result{}, nil
}

func (r *CinderAPIReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.CinderAPI) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name))

// TODO: should have minor update tasks if required
// - delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name))
return ctrl.Result{}, nil
}

func (r *CinderAPIReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.CinderAPI) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name))

// TODO: should have major version upgrade tasks
// -delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name))
return ctrl.Result{}, nil
}

// generateServiceConfigs - create Secret which holds the service configuration
func (r *CinderAPIReconciler) generateServiceConfigs(
ctx context.Context,
Expand Down
60 changes: 0 additions & 60 deletions controllers/cinderbackup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,6 @@ func (r *CinderBackupReconciler) reconcileDelete(ctx context.Context, instance *
return ctrl.Result{}, nil
}

func (r *CinderBackupReconciler) reconcileInit(
ctx context.Context,
instance *cinderv1beta1.CinderBackup,
) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' init", instance.Name))

Log.Info(fmt.Sprintf("Reconciled Service '%s' init successfully", instance.Name))
return ctrl.Result{}, nil
}

func (r *CinderBackupReconciler) reconcileNormal(ctx context.Context, instance *cinderv1beta1.CinderBackup, helper *helper.Helper) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Expand Down Expand Up @@ -516,30 +504,6 @@ func (r *CinderBackupReconciler) reconcileNormal(ctx context.Context, instance *
return ctrl.Result{}, err
}

// Handle service init
ctrlResult, err = r.reconcileInit(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

// Handle service update
ctrlResult, err = r.reconcileUpdate(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

// Handle service upgrade
ctrlResult, err = r.reconcileUpgrade(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

//
// normal reconcile tasks
//
Expand Down Expand Up @@ -652,30 +616,6 @@ func (r *CinderBackupReconciler) reconcileNormal(ctx context.Context, instance *
return ctrl.Result{}, nil
}

func (r *CinderBackupReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.CinderBackup) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name))

// TODO: should have minor update tasks if required
// - delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name))
return ctrl.Result{}, nil
}

func (r *CinderBackupReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.CinderBackup) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name))

// TODO: should have major version upgrade tasks
// -delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name))
return ctrl.Result{}, nil
}

// generateServiceConfigs - create Secret which holds the service configuration
func (r *CinderBackupReconciler) generateServiceConfigs(
ctx context.Context,
Expand Down
60 changes: 0 additions & 60 deletions controllers/cinderscheduler_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,6 @@ func (r *CinderSchedulerReconciler) reconcileDelete(ctx context.Context, instanc
return ctrl.Result{}, nil
}

func (r *CinderSchedulerReconciler) reconcileInit(
ctx context.Context,
instance *cinderv1beta1.CinderScheduler,
) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' init", instance.Name))

Log.Info(fmt.Sprintf("Reconciled Service '%s' init successfully", instance.Name))
return ctrl.Result{}, nil
}

func (r *CinderSchedulerReconciler) reconcileNormal(ctx context.Context, instance *cinderv1beta1.CinderScheduler, helper *helper.Helper) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Expand Down Expand Up @@ -515,30 +503,6 @@ func (r *CinderSchedulerReconciler) reconcileNormal(ctx context.Context, instanc
return ctrl.Result{}, err
}

// Handle service init
ctrlResult, err = r.reconcileInit(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

// Handle service update
ctrlResult, err = r.reconcileUpdate(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

// Handle service upgrade
ctrlResult, err = r.reconcileUpgrade(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

//
// normal reconcile tasks
//
Expand Down Expand Up @@ -651,30 +615,6 @@ func (r *CinderSchedulerReconciler) reconcileNormal(ctx context.Context, instanc
return ctrl.Result{}, nil
}

func (r *CinderSchedulerReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.CinderScheduler) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name))

// TODO: should have minor update tasks if required
// - delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name))
return ctrl.Result{}, nil
}

func (r *CinderSchedulerReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.CinderScheduler) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name))

// TODO: should have major version upgrade tasks
// -delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name))
return ctrl.Result{}, nil
}

// generateServiceConfigs - create Secret which holds the service configuration
func (r *CinderSchedulerReconciler) generateServiceConfigs(
ctx context.Context,
Expand Down
60 changes: 0 additions & 60 deletions controllers/cindervolume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,18 +322,6 @@ func (r *CinderVolumeReconciler) reconcileDelete(ctx context.Context, instance *
return ctrl.Result{}, nil
}

func (r *CinderVolumeReconciler) reconcileInit(
ctx context.Context,
instance *cinderv1beta1.CinderVolume,
) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' init", instance.Name))

Log.Info(fmt.Sprintf("Reconciled Service '%s' init successfully", instance.Name))
return ctrl.Result{}, nil
}

func (r *CinderVolumeReconciler) reconcileNormal(ctx context.Context, instance *cinderv1beta1.CinderVolume, helper *helper.Helper) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Expand Down Expand Up @@ -518,30 +506,6 @@ func (r *CinderVolumeReconciler) reconcileNormal(ctx context.Context, instance *
return ctrl.Result{}, err
}

// Handle service init
ctrlResult, err = r.reconcileInit(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

// Handle service update
ctrlResult, err = r.reconcileUpdate(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

// Handle service upgrade
ctrlResult, err = r.reconcileUpgrade(ctx, instance)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

//
// normal reconcile tasks
//
Expand Down Expand Up @@ -654,30 +618,6 @@ func (r *CinderVolumeReconciler) reconcileNormal(ctx context.Context, instance *
return ctrl.Result{}, nil
}

func (r *CinderVolumeReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.CinderVolume) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name))

// TODO: should have minor update tasks if required
// - delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name))
return ctrl.Result{}, nil
}

func (r *CinderVolumeReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.CinderVolume) (ctrl.Result, error) {
Log := r.GetLogger(ctx)

Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name))

// TODO: should have major version upgrade tasks
// -delete dbsync hash from status to rerun it?

Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name))
return ctrl.Result{}, nil
}

// generateServiceConfigs - create Secret which holds the service configuration and check if it's using LVM
func (r *CinderVolumeReconciler) generateServiceConfigs(
ctx context.Context,
Expand Down

0 comments on commit 84ec098

Please sign in to comment.