-
Notifications
You must be signed in to change notification settings - Fork 34
Add the NodeModulesConfig controller #513
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 the NodeModulesConfig controller #513
Conversation
✅ Deploy Preview for kubernetes-sigs-kmm ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qbarrand 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 |
/cc @mresvanis |
/hold |
667432e
to
02ab0bd
Compare
/test pull-kernel-module-management-unit-tests |
/unhold |
|
||
ctx := ctrl.SetupSignalHandler() | ||
|
||
if err = controllers.NewNodeModulesConfigReconciler(client, workerHelper).SetupWithManager(ctx, mgr); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename it to NewNMCReconciler? we already have NMC package, and ModuleNMC controller, it seems that it is a clearer name then the whole shabang...
|
||
//go:generate mockgen -source=nodemodulesconfig_reconciler.go -package=controllers -destination=mock_nodemodulesconfig_reconciler.go WorkerHelper | ||
|
||
type WorkerHelper interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it a public interface? Why not make it private? you can create in NewNodeModulesConfigReconciler and also in unit test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, unit tests would belong to a different package...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it is easier and more convenient to have unit-test in the same package, and all our "helper" interfaces already implemented as private
@@ -163,6 +164,17 @@ func main() { | |||
cmd.FatalError(setupLogger, err, "unable to create controller", "name", controllers.ModuleNMCReconcilerName) | |||
} | |||
|
|||
workerHelper := controllers.NewWorkerHelper( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to create it in main if you make it a private interface
return fmt.Errorf("node %s has no Ready condition", nmc.Name) | ||
} | ||
|
||
if status.LastTransitionTime.Before(&readyCondition.LastTransitionTime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment describing the scenarion (why we need to compare times) would be beneficial here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you can add that the reason to compare the times is in order to catch the node reboot scenario, it would be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved the comment. Does it look OK to you?
d31e620
to
d23a95a
Compare
Reconcile NodeModulesConfig resources by creating and monitoring worker Pods. Use the NodeModulesConfig status to maintain the state of modules on nodes.
d23a95a
to
c6d15bf
Compare
/lgtm |
Reconcile NodeModulesConfig resources by creating and monitoring worker Pods.
Use the NodeModulesConfig status to maintain the state of modules on nodes.
Use the plural form for the NodeModulesConfig CRD, per convention.
/cc @yevgeny-shnaidman @ybettan
Split into several PRs:
NodeModulesConfig
status management functions #514