From e2ebaa65096aa194ffd315d9af7e81ac907292d0 Mon Sep 17 00:00:00 2001 From: razo7 Date: Mon, 31 Jul 2023 19:04:50 +0300 Subject: [PATCH] Try to add FAR taint on every reconcile call Try adding the FAR taint should happen on every reconcile run, regardless of the status conditions --- controllers/fenceagentsremediation_controller.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/controllers/fenceagentsremediation_controller.go b/controllers/fenceagentsremediation_controller.go index 80d44d07..c1fc4192 100644 --- a/controllers/fenceagentsremediation_controller.go +++ b/controllers/fenceagentsremediation_controller.go @@ -155,6 +155,11 @@ func (r *FenceAgentsRemediationReconciler) Reconcile(ctx context.Context, req ct r.Log.Info("Finalizer was removed", "CR Name", req.Name) return emptyResult, nil } + // Add FAR (medik8s) remediation taint + r.Log.Info("Try adding FAR (Medik8s) remediation taint", "Fence Agent", far.Spec.Agent, "Node Name", req.Name) + if err := utils.AppendTaint(r.Client, far.Name); err != nil { + return emptyResult, err + } if meta.IsStatusConditionTrue(far.Status.Conditions, commonConditions.ProcessingType) && !meta.IsStatusConditionTrue(far.Status.Conditions, v1alpha1.FenceAgentActionSucceededType) { @@ -177,11 +182,7 @@ func (r *FenceAgentsRemediationReconciler) Reconcile(ctx context.Context, req ct r.Log.Error(err, "Invalid sharedParameters/nodeParameters from CR - edit/recreate the CR", "CR's Name", req.Name) return emptyResult, nil } - // Add FAR (medik8s) remediation taint - r.Log.Info("Try adding FAR (Medik8s) remediation taint", "Fence Agent", far.Spec.Agent, "Node Name", req.Name) - if err := utils.AppendTaint(r.Client, far.Name); err != nil { - return emptyResult, err - } + cmd := append([]string{far.Spec.Agent}, faParams...) // The Fence Agent is excutable and the parameters structure are valid, but we don't check their values r.Log.Info("Execute the fence agent", "Fence Agent", far.Spec.Agent, "Node Name", req.Name)