Skip to content

Commit

Permalink
remove unused fields of reconciler
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Aug 20, 2024
1 parent a92ab76 commit 16e04ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion controllers/vmware/test/controllers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func getManager(cfg *rest.Config, networkProvider string, withWebhooks bool) man
return err
}
}
if err := vmware.AddMachineTemplateControllerToManager(ctx, controllerCtx, mgr, true, controllerOpts); err != nil {
if err := vmware.AddMachineTemplateControllerToManager(ctx, controllerCtx, mgr, controllerOpts); err != nil {
return err
}

Expand Down
11 changes: 3 additions & 8 deletions controllers/vmware/vspheremachinetemplate_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/client-go/tools/record"
"sigs.k8s.io/cluster-api/util/patch"
"sigs.k8s.io/cluster-api/util/predicates"
ctrl "sigs.k8s.io/controller-runtime"
Expand All @@ -44,11 +43,9 @@ import (

// AddMachineTemplateControllerToManager adds the machine template controller to the provided
// manager.
func AddMachineTemplateControllerToManager(ctx context.Context, controllerManagerContext *capvcontext.ControllerManagerContext, mgr manager.Manager, supervisorBased bool, options controller.Options) error {
func AddMachineTemplateControllerToManager(ctx context.Context, controllerManagerContext *capvcontext.ControllerManagerContext, mgr manager.Manager, options controller.Options) error {
r := &vSphereMachineTemplateReconciler{
Client: controllerManagerContext.Client,
Recorder: mgr.GetEventRecorderFor("vspheremachinetemplate-controller"),
supervisorBased: supervisorBased,
Client: controllerManagerContext.Client,
}

return ctrl.NewControllerManagedBy(mgr).
Expand All @@ -63,9 +60,7 @@ func AddMachineTemplateControllerToManager(ctx context.Context, controllerManage
}

type vSphereMachineTemplateReconciler struct {
Client client.Client
Recorder record.EventRecorder
supervisorBased bool
Client client.Client
}

func (r *vSphereMachineTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func setupSupervisorControllers(ctx context.Context, controllerCtx *capvcontext.
return err
}

if err := vmware.AddMachineTemplateControllerToManager(ctx, controllerCtx, mgr, true, concurrency(vSphereMachineTemplateConcurrency)); err != nil {
if err := vmware.AddMachineTemplateControllerToManager(ctx, controllerCtx, mgr, concurrency(vSphereMachineTemplateConcurrency)); err != nil {
return err
}

Expand Down

0 comments on commit 16e04ed

Please sign in to comment.