kubelet-config: register MCP informer to trigger reconciliation on pool changes#6219
kubelet-config: register MCP informer to trigger reconciliation on pool changes#6219ankimaha-sys wants to merge 2 commits into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ankimaha-sys The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @ankimaha-sys. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
Warning Review limit reached
More reviews will be available in 4 minutes and 39 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
WalkthroughThe kubelet config controller's ChangesMCP-driven kubelet config reconciliation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…ol changes The kubelet config controller registers event handlers for KubeletConfig, FeatureGate, NodeConfig, and APIServer informers but not for MachineConfigPool. When a new MCP is created, the controller is never notified and fails to generate the per-pool kubelet MachineConfigs (97-<pool>-generated-kubelet, 98-<pool>-generated-kubelet). Users must restart the machine-config-controller pod for the configs to appear. Register Add/Update/Delete event handlers on the MCP informer so that pool additions and label changes trigger reconciliation of all KubeletConfigs, FeatureGates, and NodeConfigs, ensuring the generated MachineConfigs are created without requiring a controller restart. Fixes: openshift#5521 Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Ankit Mahajan <ankimaha@redhat.com>
756cab2 to
5e58077
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/controller/kubelet-config/kubelet_config_controller.go`:
- Around line 371-379: The current error handling in the lister Get calls for
features and nodeConfig only proceeds when err is nil but ignores all other
errors. Instead of silently dropping non-NotFound errors from
ctrl.featLister.Get and ctrl.nodeConfigLister.Get, add proper error handling
that distinguishes between NotFound errors (which are acceptable and should be
skipped) and other transient errors (which should trigger a requeue). Check if
the error is not nil and not a NotFound error, then requeue the kubelet config
for reconciliation to ensure transient cache failures don't cause missed
reconciliation cycles.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 87991c0c-84ff-4592-bb56-88fea32157c4
📒 Files selected for processing (1)
pkg/controller/kubelet-config/kubelet_config_controller.go
Log transient errors from FeatureGate and NodeConfig lister lookups in requeueKubeletConfigsForPool instead of silently ignoring them. NotFound errors remain acceptable and are skipped. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Ankit Mahajan <ankimaha@redhat.com>
9fe40f0 to
135ef52
Compare
Summary
97-<pool>-generated-kubelet,98-<pool>-generated-kubelet) are created without requiring a controller restart.Root Cause
The
New()constructor in the kubelet config controller registered informer event handlers for KubeletConfig, FeatureGate, NodeConfig, and APIServer — but not for MachineConfigPool. When a new MCP was created:syncFeatureHandler(which generates97-<pool>-generated-kubelet) was never triggered for the new poolsyncKubeletConfig(which generates98-<pool>-generated-kubelet) was never triggered for matching KubeletConfigssyncNodeConfigHandlerwas never triggered for the new poolThe only workaround was restarting the machine-config-controller pod, which caused initial ADD events to fire for FeatureGates/KubeletConfigs, triggering the missing reconciliation.
Fix
Register
AddFunc,UpdateFunc, andDeleteFunchandlers on the MCP informer:This follows the same pattern used by other MCO controllers (render, pinned-image-set, node) that already watch for MCP changes.
How to Reproduce (before fix)
oc get machineconfig -w97-demo-generated-kubelet,98-demo-generated-kubelet, andrendered-demo-*are createdrendered-demo-*is created; 97/98 configs only appear after restarting the controllerFixes: #5521
Made with Cursor
Summary by CodeRabbit