Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeReload refactor #586

Merged
merged 1 commit into from
Oct 23, 2023
Merged

NodeReload refactor #586

merged 1 commit into from
Oct 23, 2023

Conversation

worryg0d
Copy link
Collaborator

@worryg0d worryg0d commented Oct 4, 2023

The NodeReload controller was refactored. Now it doesn't update the resource spec while it reloads nodes.
Added:

  • PendingNodes shows which nodes awaiting reload
  • CompletedNodes shows which nodes are successfully reloaded
  • FailedNodes shows which nodes cannot be reloaded because they are not found

Also, in the previous implementation of the controller, it deletes resources after a successful reload of all nodes. In this implementation, it doesn't delete the resources but writes events to it.

@worryg0d worryg0d marked this pull request as draft October 4, 2023 12:45
@worryg0d worryg0d force-pushed the nodereload-refactor branch 2 times, most recently from a84dc49 to fac2810 Compare October 6, 2023 11:35
@worryg0d worryg0d marked this pull request as ready for review October 6, 2023 11:35
@worryg0d worryg0d force-pushed the nodereload-refactor branch 3 times, most recently from 5f6f38e to 2c6f78a Compare October 10, 2023 14:55
@worryg0d worryg0d self-assigned this Oct 11, 2023
@worryg0d worryg0d force-pushed the nodereload-refactor branch 3 times, most recently from d1464a2 to c8d53fc Compare October 11, 2023 12:35
@worryg0d worryg0d force-pushed the nodereload-refactor branch from c8d53fc to af21b12 Compare October 12, 2023 12:26
}
nrs.Status.NodeInProgress.ID = nodeInProgress.ID
if nrs.Status.NodeInProgress == nil {
nodeInProgress := nrs.Status.PendingNodes[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the previous indexing, like nrs.Status.PendingNodes[len(nrs.Status.PendingNodes)-1], wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have to reload nodes in the order they are presented in the spec.

}

return models.ExitReconcile, nil
l.Error(err, "Node is not found on Instaclustr",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node is not found on the Instaclustr side, something like that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Node is not found on the Instaclustr side

@@ -60,151 +68,188 @@ func (r *NodeReloadReconciler) Reconcile(ctx context.Context, req ctrl.Request)
if err != nil {
if k8serrors.IsNotFound(err) {
l.Error(err, "Node Reload resource is not found", "request", req)
return models.ExitReconcile, nil
return reconcile.Result{}, err
Copy link
Contributor

@ribaraka ribaraka Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to return nil error here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, fixed

Comment on lines +106 to +107
if nrs.Status.NodeInProgress == nil {
nodeInProgress := nrs.Status.PendingNodes[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be safer to add a check for not nil of nrs.Status.PendingNodes[0]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make any sense because it doesn't pass inside if there is a node in progress. If there is no it triggers node reloads, sets the node in progress, and pops it from the pending nodes. Then it starts checking node reload status and when it finishes it sets node in progress to nil.

@worryg0d worryg0d force-pushed the nodereload-refactor branch from 3f4bb22 to e894f46 Compare October 23, 2023 07:28
@worryg0d worryg0d requested a review from ribaraka October 23, 2023 07:29
@worryg0d worryg0d added enhancement New feature or request refactor Code improvements or refactorings labels Oct 23, 2023
@taaraora taaraora merged commit 9f2c68b into main Oct 23, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Code improvements or refactorings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants