Skip to content

Commit

Permalink
Add support for reconciles machine taints with nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
enxebre committed Dec 21, 2018
1 parent d19e6b6 commit 2b90cd2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/controller/machine/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul
name := m.Name
klog.Infof("Running reconcile Machine for %s\n", name)

if err := r.reconcileTaintsWithNode(*m); err != nil {
klog.Infof("failed to reconcile machine object %v taints with its node due to error %v.", name, err)
return reconcile.Result{}, err
}

// If object hasn't been deleted and doesn't have a finalizer, add one
// Add a finalizer to newly created objects.
if m.ObjectMeta.DeletionTimestamp.IsZero() &&
Expand Down Expand Up @@ -209,6 +214,14 @@ func (c *ReconcileMachine) update(ctx context.Context, new_machine *clusterv1.Ma
return c.actuator.Update(ctx, cluster, new_machine)
}

func (r *ReconcileMachine) reconcileTaintsWithNode(machine clusterv1.Machine) error {
if node := machine.Status.NodeRef; node != nil {
// TODO: sync taints logic and unit test
return r.Client.Update(context.Background(), node)
}
return nil
}

func (c *ReconcileMachine) delete(ctx context.Context, machine *clusterv1.Machine) error {
cluster, err := c.getCluster(ctx, machine)
if err != nil {
Expand Down

0 comments on commit 2b90cd2

Please sign in to comment.