Add deletionTimestamp check to avoid race condition#982
Add deletionTimestamp check to avoid race condition#982wpross wants to merge 2 commits intokubernetes:masterfrom
Conversation
|
This issue is currently awaiting triage. If the repository mantainers determine this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Welcome @wpross! |
|
Hi @wpross. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Please add a unit test for this fix. |
done. |
|
/ok-to-test |
|
@wpross Thanks for looking into this! We removed Bazel recently so this PR might needs to be updated. /assign @YifeiZhuang |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wpross 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 |
|
/assign @mmamczur @FelipeYepez |
| return true | ||
| } | ||
|
|
||
| if !servicehelper.HasLBFinalizer(service) { |
There was a problem hiding this comment.
This is forked from here https://github.com/kubernetes/cloud-provider/blob/master/controllers/service/controller.go#L364
And it was on purpose. The service deletion is delayed and waits for all finalizers to be removed before actually deleting the object.
What are the side effect, e.g. resource leakage did you see other than the error messages.
There was a problem hiding this comment.
Thanks for pointing it out @YifeiZhuang
so yes, this code was forked and is used only if the service has a specific LB class set. For usual services (no loadBalancerClass) which I believe the fix is intended for, you need to change the code in https://github.com/kubernetes/cloud-provider/ and vendor it in here
This PR is to fix Issue 981.
It makes sure to check the
deletionTimestampto not sync in case the service is to be deleted innodeSyncService.In
needsCleanupit checks thedeletionTimestampbefore checking for the finalizer to make sure the right path (not the else) is taken.