Skip to content

Commit

Permalink
nodereload controller fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohdan Siryk authored and Bohdan Siryk committed Nov 8, 2023
1 parent 7a6135a commit 8f79c7e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/clusterresources/nodereload_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ func (r *NodeReloadReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return reconcile.Result{}, err
}

patch := nrs.NewPatch()

if len(nrs.Status.PendingNodes)+len(nrs.Status.CompletedNodes)+len(nrs.Status.FailedNodes) == 0 {
patch := nrs.NewPatch()
nrs.Status.PendingNodes = nrs.Spec.Nodes
err := r.Status().Patch(ctx, nrs, patch)
if err != nil {
Expand Down Expand Up @@ -120,6 +119,8 @@ func (r *NodeReloadReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return reconcile.Result{}, err
}

patch := nrs.NewPatch()

nrs.Status.NodeInProgress = nodeInProgress
if len(nrs.Status.PendingNodes) > 0 {
nrs.Status.PendingNodes = nrs.Status.PendingNodes[1:]
Expand Down Expand Up @@ -154,6 +155,8 @@ func (r *NodeReloadReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return reconcile.Result{}, err
}

patch := nrs.NewPatch()

nrs.Status.CurrentOperationStatus = &v1beta1.Operation{
OperationID: nodeReloadStatus.OperationID,
TimeCreated: nodeReloadStatus.TimeCreated,
Expand All @@ -177,7 +180,7 @@ func (r *NodeReloadReconciler) Reconcile(ctx context.Context, req ctrl.Request)

if nodeReloadStatus.Status != nodeReloadOperationStatusCompleted {
l.Info("Node Reload operation is not completed yet, please wait a few minutes",
"nodeID", nrs.Status.NodeInProgress,
"node ID", nrs.Status.NodeInProgress,
"status", nrs.Status,
)

Expand Down

0 comments on commit 8f79c7e

Please sign in to comment.