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

Add CP upgrade reconciler logic #7144

Merged
merged 3 commits into from
Dec 21, 2023

Conversation

rahulbabu95
Copy link
Member

@rahulbabu95 rahulbabu95 commented Dec 7, 2023

Add CP uprgader controller logic that is responsible for scheduling node upgrade objects for all control plane nodes. Tested the controller by manually applying the CP upgrade object.

Issue #, if available:

Description of changes:

Testing (if applicable):

Documentation added/planned (if applicable):

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@eks-distro-bot eks-distro-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 7, 2023
Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Attention: 21 lines in your changes are missing coverage. Please review.

Comparison is base (1c1ca86) 71.58% compared to head (d6540ca) 71.65%.
Report is 30 commits behind head on main.

Files Patch % Lines
controllers/controlplaneupgrade_controller.go 84.00% 15 Missing and 5 partials ⚠️
controllers/nodeupgrade_controller.go 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7144      +/-   ##
==========================================
+ Coverage   71.58%   71.65%   +0.06%     
==========================================
  Files         545      548       +3     
  Lines       42349    42668     +319     
==========================================
+ Hits        30314    30572     +258     
- Misses      10343    10397      +54     
- Partials     1692     1699       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rahulbabu95 rahulbabu95 changed the title Inital logic for CP upgrade controller code Add CP upgrade reconciler logic Dec 20, 2023
@rahulbabu95 rahulbabu95 marked this pull request as ready for review December 20, 2023 12:06
controllers/controlplaneupgrade_controller.go Show resolved Hide resolved
controllers/controlplaneupgrade_controller.go Outdated Show resolved Hide resolved
if err := r.client.Create(ctx, nodeUpgrade); client.IgnoreAlreadyExists(err) != nil {
return ctrl.Result{}, fmt.Errorf("failed to create node upgrader for machine %s: %v", machineRef.Name, err)
}
for {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have a nested for loop here? I think the way to wait is to create the objects once, and then return the controller, and then have a check above to see if the objects were already created before attempting to create.

Copy link
Member Author

Choose a reason for hiding this comment

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

we need the nested for because we want to create the node upgrade one by one... Although it looks like a nested for it doesn't do anything that actually wait for each of the nodeupgrader object to run through it's lifecycle.

controllers/controlplaneupgrade_controller.go Show resolved Hide resolved
return ctrl.Result{}, nil
}

func patchControlPlaneUpgrade(ctx context.Context, log logr.Logger, patchHelper *patch.Helper, cpUpgrade anywherev1.ControlPlaneUpgrade, patchOpts ...patch.Option) error {
Copy link
Member

Choose a reason for hiding this comment

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

Why is log passed in here? Also, any reason you moved this to it's own function if it only contains one line?

Copy link
Member Author

Choose a reason for hiding this comment

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

right, We don't need it here.!

} else {
return ctrl.Result{}, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
} else {
return ctrl.Result{}, nil
}
}
return ctrl.Result{}, nil

@rahulbabu95 rahulbabu95 force-pushed the modular-upg-cp-upg-controller branch from f1fa367 to c4a27cb Compare December 21, 2023 07:27
Comment on lines 149 to 151
} else {
return ctrl.Result{}, fmt.Errorf("getting node upgrader for machine %s: %v", machineRef.Name, err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
} else {
return ctrl.Result{}, fmt.Errorf("getting node upgrader for machine %s: %v", machineRef.Name, err)
}
}
return ctrl.Result{}, fmt.Errorf("getting node upgrader for machine %s: %v", machineRef.Name, err)

Rahul Ganesh added 2 commits December 20, 2023 23:34
Signed-off-by: Rahul Ganesh <[email protected]>
Signed-off-by: Rahul Ganesh <[email protected]>
@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eks-distro-bot eks-distro-bot merged commit fe7e7b3 into aws:main Dec 21, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants