-
Notifications
You must be signed in to change notification settings - Fork 771
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: SidecarSet Expectations Leakage Bug #1301
fix: SidecarSet Expectations Leakage Bug #1301
Conversation
Welcome @wangwu50! It looks like this is your first PR to openkruise/kruise 🎉 |
fixes #1293 |
@@ -115,9 +112,8 @@ var _ reconcile.Reconciler = &ReconcileSidecarSet{} | |||
// ReconcileSidecarSet reconciles a SidecarSet object | |||
type ReconcileSidecarSet struct { | |||
client.Client | |||
scheme *runtime.Scheme | |||
updateExpectations expectations.UpdateExpectations |
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.
Why did you remove this filed? My understanding of the previous bug had nothing to do with this field being defined here, right?
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.
Only updateExpectations were removed because they were initialized in utils
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.
A utils is added so that the sidecarset handler can access it, similar to how cloneset handles it
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 can move the function to file https://github.com/openkruise/kruise/blob/master/pkg/control/sidecarcontrol/util.go.
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.
OK, I've moved it
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## master #1301 +/- ##
==========================================
- Coverage 48.60% 48.57% -0.03%
==========================================
Files 151 151
Lines 21005 21042 +37
==========================================
+ Hits 10210 10222 +12
- Misses 9680 9702 +22
- Partials 1115 1118 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -82,6 +102,9 @@ func (p *enqueueRequestForPod) updatePod(q workqueue.RateLimitingInterface, old, | |||
if sidecarSet.Spec.UpdateStrategy.Type == appsv1alpha1.NotUpdateSidecarSetStrategyType { | |||
continue | |||
} | |||
if newPod.DeletionTimestamp != nil { |
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 think you should not judge the deletionTimestamp, and use the ObserveUpdated function.
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.
ObserveUpdated does not determine if the pod is deleted if the pod is pending deletion
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.
If this pod is an older version, there may be problems
@@ -57,6 +74,9 @@ func (p *enqueueRequestForPod) addPod(q workqueue.RateLimitingInterface, obj run | |||
} | |||
|
|||
for _, sidecarSet := range sidecarSets { | |||
if pod.DeletionTimestamp != nil { |
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 think it is not necessary to execute the expectation function when add pod.
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.
on a restart of the controller manager, it's possible a new pod shows up in a state that is already pending deletion. Prevent the pod from being a creation observation.
5f868e5
to
503a149
Compare
Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com>
Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com>
Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com>
7a9a37e
to
79bd334
Compare
/lgtm |
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
Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com>
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zmberg 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 |
* fix: SidecarSet Expectations Leakage Bug Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: Modify the code as suggested Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: use ObserveUpdated func when update Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: observeUpdated before type check Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> --------- Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> Co-authored-by: wangwenchao7 <wangwenchao7@xiaomi.com>
* fix: SidecarSet Expectations Leakage Bug Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: Modify the code as suggested Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: use ObserveUpdated func when update Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: observeUpdated before type check Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> --------- Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> Co-authored-by: wangwenchao7 <wangwenchao7@xiaomi.com>
* fix: SidecarSet Expectations Leakage Bug Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: Modify the code as suggested Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: use ObserveUpdated func when update Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: observeUpdated before type check Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> --------- Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> Co-authored-by: wangwenchao7 <wangwenchao7@xiaomi.com>
* fix: SidecarSet Expectations Leakage Bug Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: Modify the code as suggested Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: use ObserveUpdated func when update Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> * fix: observeUpdated before type check Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> --------- Signed-off-by: wangwenchao7 <wangwenchao7@xiaomi.com> Co-authored-by: wangwenchao7 <wangwenchao7@xiaomi.com>
* fix: SidecarSet Expectations Leakage Bug * fix: Modify the code as suggested * fix: use ObserveUpdated func when update * fix: observeUpdated before type check --------- Co-authored-by: wangwenchao7 <wangwenchao7@xiaomi.com>
fix sidecarSet expectations leakage bug when delete pod alfter update sidecarset