Skip to content

Commit

Permalink
Merge pull request #1388 from tahsinrahman/explicit-client-machine
Browse files Browse the repository at this point in the history
🏃 MachineReconciler: make Client a proper field
  • Loading branch information
k8s-ci-robot authored Sep 5, 2019
2 parents c5952ee + c0438c3 commit 203d8f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions controllers/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ var (

// MachineReconciler reconciles a Machine object
type MachineReconciler struct {
client.Client
Log logr.Logger
Client client.Client
Log logr.Logger

controller controller.Controller
recorder record.EventRecorder
Expand Down Expand Up @@ -91,7 +91,7 @@ func (r *MachineReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, reterr e
}

// Initialize the patch helper
patchHelper, err := patch.NewHelper(m, r)
patchHelper, err := patch.NewHelper(m, r.Client)
if err != nil {
return ctrl.Result{}, err
}
Expand Down Expand Up @@ -310,7 +310,7 @@ func (r *MachineReconciler) reconcileDeleteExternal(ctx context.Context, m *clus

// Issue a delete request for any object that has been found.
for _, obj := range objects {
if err := r.Delete(ctx, obj); err != nil && !apierrors.IsNotFound(err) {
if err := r.Client.Delete(ctx, obj); err != nil && !apierrors.IsNotFound(err) {
return false, errors.Wrapf(err,
"failed to delete %v %q for Machine %q in namespace %q",
obj.GroupVersionKind(), obj.GetName(), m.Name, m.Namespace)
Expand Down
4 changes: 2 additions & 2 deletions controllers/machine_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (r *MachineReconciler) reconcileExternal(ctx context.Context, m *clusterv1.

if !util.HasOwnerRef(obj.GetOwnerReferences(), machineOwnerRef) {
obj.SetOwnerReferences(util.EnsureOwnerRef(obj.GetOwnerReferences(), machineOwnerRef))
if err := r.Patch(ctx, obj, objPatch); err != nil {
if err := r.Client.Patch(ctx, obj, objPatch); err != nil {
return nil, errors.Wrapf(err,
"failed to set OwnerReference on %v %q for Machine %q in namespace %q",
obj.GroupVersionKind(), ref.Name, m.Name, m.Namespace)
Expand Down Expand Up @@ -247,7 +247,7 @@ func (r *MachineReconciler) reconcileClusterStatus(ctx context.Context, cluster
// set the Status.ControlPlaneInitialized on the Cluster.
if util.IsControlPlaneMachine(m) && m.Status.NodeRef != nil {
if !cluster.Status.ControlPlaneInitialized {
patchHelper, err := patch.NewHelper(cluster, r)
patchHelper, err := patch.NewHelper(cluster, r.Client)
if err != nil {
return errors.Wrapf(err, "failed to create patch helper for Cluster %q in namespace %q",
cluster.Name, cluster.Namespace)
Expand Down

0 comments on commit 203d8f7

Please sign in to comment.