Skip to content

Commit

Permalink
Try to add FAR taint on every reconcile call
Browse files Browse the repository at this point in the history
Try adding the FAR taint should happen on every reconcile run, regardless of the status conditions
  • Loading branch information
razo7 committed Jul 31, 2023
1 parent 8b7fbf8 commit e2ebaa6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions controllers/fenceagentsremediation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit e2ebaa6

Please sign in to comment.