Closed chaosi-zju closed 1 week ago
@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 newStatus
and rebalancer.Status
shared the slice of rebalancer.Status.ObservedWorkloads
.
If this slice didn't change from nil to non-nil or occurs expansion, modification to newStatus
will also be applied to the rebalancer.Status
, which will lead to patch status
ignored.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 53.06%. Comparing base (
6e5a602
) to head (f672ffa
). Report is 20 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Is there any further comments? If any other suggestions, please let me know.
@XiShanYongYe-Chang If you want to get approval from someone else, you can cc or assign.
/assign
If you want to get approval from someone else, you can cc or assign.
Got it.
modification to newStatus will also be applied to the rebalancer.Status, which will lead to patch status failed.
Won't lead to patch failed, but non-ops, right? That means the patch will be ignored.
Won't lead to patch failed, but non-ops, right? That means the patch will be ignored.
yes, the patch will be ignored.
[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
What's the next PR blocked by this?
What's the next PR blocked by this?
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.
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?: