-
Notifications
You must be signed in to change notification settings - Fork 19
Do not reconcile NodeMaintenance if deletion requested #154
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: vaspahomov <[email protected]>
WalkthroughUpdates reconciliation logic in nodemaintenance controller: adjusts finalizer handling based on DeletionTimestamp, adds finalizer when absent on non-deleting objects, and skips reconciliation with a log when deletion is in progress and finalizer is missing. Introduces an early return during deletion. Adds an informational log message. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant K8s as Kubernetes API
participant Ctrl as NodeMaintenance Controller
K8s->>Ctrl: Reconcile(NodeMaintenance)
alt Finalizer missing AND not deleting
Ctrl->>K8s: Update: add finalizer
Note right of Ctrl: Continue normal reconciliation
else Finalizer missing AND deleting
Ctrl-->>K8s: Log "deletion in progress, finalizer missing"
Ctrl-->>K8s: Return (skip further reconciliation)
else Finalizer present
Ctrl->>Ctrl: Proceed with standard reconcile path
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
|
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 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vaspahomov 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 |
|
/ok-to-test |
|
@vaspahomov sorry for the late reply and thanks for the contribution! |
|
Thanks for fixing this bug :) I think your change already addresses the issue where NodeMaintenance objects being deleted, and does not have the finalizer anymore would fall through to normal maintenance logic. I believe the problem originated from the if/else branch being a bit hard to read, hence I would suggest something Currently we're checking finalizer presence first, but the deletion state is really what should determine the reconcile path. A pattern like this could eliminate the complex compound conditions: The current fix works correctly, but restructuring around deletion state might prevent similar issues in the future. What do you think about this approach? |
|
@vaspahomov: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Why we need this PR
It fixes the bug:
If we are deleting NodeMaintenance on existing Node - node-maintenance-operator sometimes keeps taints. This caused by that resource can be reconciled multiple times during deletion with consequent "reconcile normal" and "reconcile delete".
Changes made
Which issue(s) this PR fixes
Test plan