From 2b90cd2fbe70e596b08aecb52153c16df77f98b4 Mon Sep 17 00:00:00 2001 From: Enxebre Date: Fri, 21 Dec 2018 15:42:30 +0100 Subject: [PATCH] Add support for reconciles machine taints with nodes --- pkg/controller/machine/controller.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/controller/machine/controller.go b/pkg/controller/machine/controller.go index 3bc2d7c76bb2..baa20cfcfd90 100644 --- a/pkg/controller/machine/controller.go +++ b/pkg/controller/machine/controller.go @@ -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() && @@ -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 {