-
Notifications
You must be signed in to change notification settings - Fork 1k
Revert "Revert "Merge pull request #3808 from ctripcloud/refactor-execution-workstatus"" #4227
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: master
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
…factor-execution-workstatus"" This reverts commit 67de65d. Signed-off-by: lxtywypc <[email protected]>
4ecd192 to
0c79325
Compare
|
Ask for some comments from @RainbowMango and @chaunceyjiang . |
|
|
||
| func (c *WorkStatusController) onUpdate(old, cur interface{}) { | ||
| // Still need to compare the whole object because the interpreter is able to take any part of object to reflect status. | ||
| if !reflect.DeepEqual(old, cur) { |
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.
The resourceVersion is always unequal, so it seems like it's always true here, right?
|
Humm...Do you think it is necessary to split this pr into small parts to do a deep review again? If you think so, I'm glad to take a try this time. |
Hi @lxtywypc, I have communicated with @RainbowMango about this PR before. He may be more interested in knowing what benefits we can bring by doing this, besides the current way of modification. Are there any other means to achieve this goal? Perhaps some additional information can be provided from this perspective. |
|
Hi @XiShanYongYe-Chang . As what I described in #3707, both The workload might be updated frequentely during releasing, while the status might changes more often. When The conflict would be reduced if we change the way to update status from And there might be plenty of useless updating attempts if the two controllers try to update workload at the same time. So the pr is to make the controllers perform on their own duties, that would make the workflow more clear, and reduce the conflict and useless updating attemts. |
|
Thanks @lxtywypc. I understand this point. |
|
@lxtywypc Thanks. I can feel the pain point as I commented at #4282 (comment). I'll look at ASAP. Thanks. |
zhzhuang-zju
left a comment
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.
Hello, thank you for your important commit! Review is ongoing, and my viewpoint just for reference only.
| @@ -0,0 +1,919 @@ | |||
| package execution | |||
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.
You may need to add license at the beginning of the file
| // in member clusters. | ||
| needUpdate, err := c.ObjectWatcher.NeedsUpdate(clusterName, desiredObj, observedObj) | ||
| if err != nil { | ||
| if !helper.IsResourceApplied(&workObject.Status) { |
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.
Is it not necessary to determine needUpdate before refreshing the manifeststatus, and does this lead to data conflicts?
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.
Previously, my idea was to judge if an update is needed before sync work status, and if needUpdate, then not sync work status first. like
if needUpdate {
klog.Infof("%s need to be updated, sync work status later", fedKey.String())
return nil
}But now I understand that sync work status will be triggered before and after update, and workQueue will process resource asynchronously, so I think your choice to not judge needUpdate is a little better.
| // needUpdateCondition judges if the Applied condition needs to update. | ||
| needUpdateCondition := func() bool { | ||
| lastWorkAppliedCondition := meta.FindStatusCondition(work.Status.Conditions, workv1alpha1.WorkApplied).DeepCopy() | ||
|
|
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.
This is to skip unnecessary update operations. Would it be simpler to compare the values before and after line L401 to determine if an update is needed?
This reverts commit 67de65d.
What type of PR is this?
/kind feature
What this PR does / why we need it:
After #4080 , we could bring #3808 back for #3959 (comment).
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: