-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: copy drift/diff details from work status to binding status #960
Conversation
// or the failed placements are changed. | ||
if condition.EqualCondition(oldAppliedCondition, newAppliedCondition) && condition.EqualCondition(oldAvailableCondition, newAvailableCondition) { | ||
// or the failed/diffed/drifted placements are changed. | ||
if !comparePlacements(oldWork, newWork) && condition.EqualCondition(oldAppliedCondition, newAppliedCondition) && condition.EqualCondition(oldAvailableCondition, newAvailableCondition) { |
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.
Hi Britania! Glad that you caught the error in this flow; but the current setup kind of defeats the purpose of this check, which was meant to reduce the overhead for doing comparisons.
151221c
to
7f1f20f
Compare
7f1f20f
to
f680d1c
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.
Added some comments, PTAL 🙏
a3d7658
to
19110a0
Compare
} else { | ||
oldResourceSnapshot := oldWork.Labels[fleetv1beta1.ParentResourceSnapshotIndexLabel] | ||
newResourceSnapshot := newWork.Labels[fleetv1beta1.ParentResourceSnapshotIndexLabel] | ||
if oldResourceSnapshot == "" || newResourceSnapshot == "" { | ||
klog.ErrorS(controller.NewUnexpectedBehaviorError(errors.New("found an invalid work without parent-resource-snapshot-index")), | ||
"Could not find the parent resource snapshot index label", "oldWork", klog.KObj(oldWork), "oldResourceSnapshotLabelValue", oldResourceSnapshot, | ||
"newWork", klog.KObj(newWork), "newResourceSnapshotLabelValue", newResourceSnapshot) | ||
return | ||
} | ||
// There is an edge case that, the work spec is the same but from different resourceSnapshots. | ||
// WorkGenerator will update the work because of the label changes, but the generation is the same. | ||
// When the normal update happens, the controller will set the applied condition as false and wait | ||
// until the work condition has been changed. | ||
// In this edge case, we need to requeue the binding to update the binding status. | ||
if oldResourceSnapshot == newResourceSnapshot { | ||
klog.V(2).InfoS("The work applied or available condition stayed as true, no need to reconcile", "oldWork", klog.KObj(oldWork), "newWork", klog.KObj(newWork)) | ||
return | ||
} | ||
} |
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.
I wonder if we still need this?
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.
Yes. I am only comparing the status, so it is still necessary to have these checks that we implemented recently.
Description of your changes
Fixes #
I have:
copied work status drift/diff details to binding status
unit tests for new functions created
Run
make reviewable
to ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer