diff --git a/cmd/aro/operator.go b/cmd/aro/operator.go index 507c761669b..6ed38bca917 100644 --- a/cmd/aro/operator.go +++ b/cmd/aro/operator.go @@ -191,7 +191,7 @@ func operator(ctx context.Context, log *logrus.Entry) error { client)).SetupWithManager(mgr); err != nil { return fmt.Errorf("unable to create controller %s: %v", autosizednodes.ControllerName, err) } - if err = (machinehealthcheck.NewMachineHealthCheckReconciler( + if err = (machinehealthcheck.NewReconciler( log.WithField("controller", machinehealthcheck.ControllerName), client, dh)).SetupWithManager(mgr); err != nil { return fmt.Errorf("unable to create controller %s: %v", machinehealthcheck.ControllerName, err) diff --git a/pkg/operator/controllers/machinehealthcheck/machinehealthcheck_controller.go b/pkg/operator/controllers/machinehealthcheck/machinehealthcheck_controller.go index d518d981efb..7a9a137b2f3 100644 --- a/pkg/operator/controllers/machinehealthcheck/machinehealthcheck_controller.go +++ b/pkg/operator/controllers/machinehealthcheck/machinehealthcheck_controller.go @@ -37,14 +37,14 @@ const ( enabled string = "aro.machinehealthcheck.enabled" ) -type MachineHealthCheckReconciler struct { +type Reconciler struct { base.AROController dh dynamichelper.Interface } -func NewMachineHealthCheckReconciler(log *logrus.Entry, client client.Client, dh dynamichelper.Interface) *MachineHealthCheckReconciler { - return &MachineHealthCheckReconciler{ +func NewReconciler(log *logrus.Entry, client client.Client, dh dynamichelper.Interface) *Reconciler { + return &Reconciler{ AROController: base.AROController{ Log: log, Client: client, @@ -56,7 +56,7 @@ func NewMachineHealthCheckReconciler(log *logrus.Entry, client client.Client, dh // Reconcile watches MachineHealthCheck objects, and if any changes, // reconciles the associated ARO MachineHealthCheck object -func (r *MachineHealthCheckReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) { +func (r *Reconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) { instance, err := r.GetCluster(ctx) if err != nil { @@ -70,7 +70,7 @@ func (r *MachineHealthCheckReconciler) Reconcile(ctx context.Context, request ct r.Log.Debug("running") if !instance.Spec.OperatorFlags.GetSimpleBoolean(managed) { - r.SetProgressing(ctx, "MHC and it's alerts are disabled because this cluster is not MHC managed.") + r.SetProgressing(ctx, "Not MHC Managed for cluster maintenance purpose.") err := r.dh.EnsureDeleted(ctx, "MachineHealthCheck", "openshift-machine-api", "aro-machinehealthcheck") if err != nil { @@ -134,7 +134,7 @@ func (r *MachineHealthCheckReconciler) Reconcile(ctx context.Context, request ct } // SetupWithManager will manage only our MHC resource with our specific controller name -func (r *MachineHealthCheckReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { aroClusterPredicate := predicate.NewPredicateFuncs(func(o client.Object) bool { return strings.EqualFold(arov1alpha1.SingletonClusterName, o.GetName()) }) diff --git a/pkg/operator/controllers/machinehealthcheck/machinehealthcheck_controller_test.go b/pkg/operator/controllers/machinehealthcheck/machinehealthcheck_controller_test.go index 2db7d61bbb6..a9ef0dd5a46 100644 --- a/pkg/operator/controllers/machinehealthcheck/machinehealthcheck_controller_test.go +++ b/pkg/operator/controllers/machinehealthcheck/machinehealthcheck_controller_test.go @@ -225,7 +225,7 @@ func TestMachineHealthCheckReconciler(t *testing.T) { ctx := context.Background() - r := NewMachineHealthCheckReconciler( + r := NewReconciler( logrus.NewEntry(logrus.StandardLogger()), clientBuilder.Build(), mdh,