node-maintenance-operator
node-maintenance-operator copied to clipboard
Configurable MaxConcurrentReconciles
Why we need this PR
Default value for controller-manager for MaxConcurrentReconciles is 1.
If we are going to start n parallel NodeMaintenances at the same time. We'll handle last one after n * d time. Where d is duration of reconcile.
In current model the longest reconcile is more then 30s
That means - if we are starting ~50 parallel NodeMaintenances and each of them are failed to finish immediately (some blocking PDB exists) we we'll came up with the last one only after ~30mins.
Changes made
Added cli arg to override MaxConcurrentReconciles
Which issue(s) this PR fixes
Test plan
Summary by CodeRabbit
- New Features
- Added a command-line option to control the maximum number of concurrent reconciliation processes for node maintenance.
- Improvements
- Enhanced configurability of node maintenance operations by allowing users to set concurrency limits.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: vaspahomov Once this PR has been reviewed and has the lgtm label, please assign clobrano for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Walkthrough
A new configuration option for maximum concurrent reconciles was introduced for the NodeMaintenanceReconciler. This includes adding a struct field, updating the controller setup to use this concurrency limit, and exposing a command-line flag to configure it. Test setup is also updated to initialize this field.
Changes
| File(s) | Change Summary |
|---|---|
| controllers/nodemaintenance_controller.go | Added MaxConcurrentReconciles field to reconciler struct, updated controller builder to use it, and imported required package. |
| main.go | Added max-concurrent-reconciles flag, passed value to reconciler struct, and adjusted formatting. |
| controllers/controllers_suite_test.go | Initialized MaxConcurrentReconciles to 1 in test reconciler setup. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant Main
participant NodeMaintenanceReconciler
participant ControllerRuntime
User->>Main: Start application with flags
Main->>Main: Parse max-concurrent-reconciles flag
Main->>NodeMaintenanceReconciler: Initialize with MaxConcurrentReconciles value
NodeMaintenanceReconciler->>ControllerRuntime: SetupWithManager (with MaxConcurrentReconciles)
ControllerRuntime-->>NodeMaintenanceReconciler: Controller runs with specified concurrency
Poem
In the warren, code hops anew,
Concurrency capped, just one will do.
A flag for the keepers, so clever and bright,
Now reconciles march, one per night.
With options set and tests aligned,
The rabbits rejoice—control refined!
🐇✨
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Hi @vaspahomov. Thanks for your PR.
I'm waiting for a medik8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
some first thoughts...
- I don't feel comfortable adding parallelism to the reconciler without any test code
- We should do something about the logger, which is a field of the reconciler, and being overwritten at the beginning of each reconcile. Probably should not be part of the reconciler anymore. Also, the CR being processed need to be added to the logger, so it's logged in every log statement
- The lease manager should not be an issue on a quick look
@razo7 @mshitrit WDYT?
I agree that test code is essential here to verify that nothing is messed up for concurrent NMO reconciles
/test 4.18-openshift-e2e