-
Notifications
You must be signed in to change notification settings - Fork 885
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 patching WorkloadRebalancer failed due to misuse of shared slices #4875
Conversation
@XiShanYongYe-Chang @RainbowMango Hello, sorry for this bug, please help review once more. In previous code: // get previous status and update basing on it
newStatus = rebalancer.Status
if len(newStatus.ObservedWorkloads) == 0 {
newStatus = c.buildWorkloadRebalancerStatus(rebalancer)
} Actually If this slice didn't change from nil to non-nil or occurs expansion, modification to |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #4875 +/- ##
==========================================
+ Coverage 52.98% 53.06% +0.08%
==========================================
Files 250 251 +1
Lines 20421 20387 -34
==========================================
- Hits 10820 10819 -1
+ Misses 8881 8854 -27
+ Partials 720 714 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
ca74ee2
to
f672ffa
Compare
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
Is there any further comments? If any other suggestions, please let me know. |
@XiShanYongYe-Chang /assign |
Got it. |
Won't lead to patch failed, but non-ops, right? That means the patch will be ignored. |
yes, the patch will be ignored. |
pkg/controllers/workloadrebalancer/workloadrebalancer_controller.go
Outdated
Show resolved
Hide resolved
Signed-off-by: chaosi-zju <[email protected]>
f672ffa
to
ccfc43e
Compare
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 |
What's the next PR blocked by this? |
|
or #4876 if you prefer |
I can review them but please also ask for review from controller owners. |
ok |
What type of PR is this?
/kind bug
What this PR does / why we need it:
fix patching WorkloadRebalancer failed due to misuse of shared slices.
in previous code:
actually
newStatus
andrebalancer.Status
shared the slice ofrebalancer.Status.ObservedWorkloads
.if this slice didn't change from nil to non-nil or occurs expansion, modification to
newStatus
will also be applied to therebalancer.Status
, which will lead topatch status
failed.Which issue(s) this PR fixes:
Fixes part of #4840
Special notes for your reviewer:
Does this PR introduce a user-facing change?: