-
Notifications
You must be signed in to change notification settings - Fork 921
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
fix the issue where the binding gracefulEvictionTask can never be clear #6227
Conversation
…gracefulEvictionTask clearance, move the generation judgment logic to the reconcile Signed-off-by: changzhen <changzhen5@huawei.com>
d2e2cb6
to
cbfc085
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #6227 +/- ##
==========================================
- Coverage 47.90% 47.89% -0.02%
==========================================
Files 676 676
Lines 55962 55962
==========================================
- Hits 26809 26801 -8
- Misses 27405 27410 +5
- Partials 1748 1751 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
/cc @RainbowMango |
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.
/assign
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.
Pull Request Overview
This PR fixes the issue where a binding’s gracefulEvictionTask can never be cleared by updating how tasks are assessed and retried. Key changes include:
- Changing the assessEvictionTasks call to accept a structured assessmentOption containing scheduling and observed status information.
- Updating the predicate functions in both RB and CRB controllers to simplify task emptiness checks.
- Modifying test cases and adding the Generation field to ensure proper scheduling status handling.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
pkg/controllers/gracefuleviction/rb_graceful_eviction_controller.go | Updates assessEvictionTasks call and predicate logic for ResourceBinding |
pkg/controllers/gracefuleviction/crb_graceful_eviction_controller.go | Updates assessEvictionTasks call and predicate logic for ClusterResourceBinding |
pkg/controllers/gracefuleviction/evictiontask.go | Introduces a new "hasScheduled" field in assessmentOption and adjusts task assessment |
pkg/controllers/gracefuleviction/evictiontask_test.go | Adjusts test cases to align with the new task evaluation including hasScheduled flag |
pkg/controllers/gracefuleviction/rb_graceful_eviction_controller_test.go | Adds Generation to the binding to simulate correct scheduling behavior |
pkg/controllers/gracefuleviction/crb_graceful_eviction_controller_test.go | Adds Generation to the binding to simulate correct scheduling behavior |
Comments suppressed due to low confidence (3)
pkg/controllers/gracefuleviction/rb_graceful_eviction_controller.go:114
- Removing the check for SchedulerObservedGeneration may trigger unnecessary reconciliations. If this change is intentional, please add a comment to document the new behavior.
return len(newObj.Spec.GracefulEvictionTasks) != 0
pkg/controllers/gracefuleviction/crb_graceful_eviction_controller.go:114
- Eliminating the check for SchedulerObservedGeneration might lead to processing update events even when scheduling hasn’t changed. Please verify if this change is intended and document accordingly.
return len(newObj.Spec.GracefulEvictionTasks) != 0
pkg/controllers/gracefuleviction/evictiontask.go:50
- [nitpick] Consider using a temporary variable for the per-task timeout instead of modifying the opt.timeout field directly. This change could improve clarity by keeping the assessmentOption immutable within each loop iteration.
if task.GracePeriodSeconds != nil { opt.timeout = time.Duration(*task.GracePeriodSeconds) * time.Second }
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango 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 |
Please help to cherry-pick this to release branches. |
…k-of-#6227-upstream-release-1.11 Automated cherry pick of #6227: to prevent the generation judgment from always being false
…k-of-#6227-upstream-release-1.13 Automated cherry pick of #6227: to prevent the generation judgment from always being false
…k-of-#6227-upstream-release-1.12 Automated cherry pick of #6227: to prevent the generation judgment from always being false
What type of PR is this?
/kind bug
What this PR does / why we need it:
When the binding object is scheduled but there is no result, the SchedulerObservedGeneration in the binding object status will not be set to the generation value, which results in graceful-eviction-controller will not be able to handle gracefulEvictionTask and will always remain.
Which issue(s) this PR fixes:
Fixes #3747
Special notes for your reviewer:
Does this PR introduce a user-facing change?: