-
Notifications
You must be signed in to change notification settings - Fork 39.4k
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
Bugfix:statefulSet would not recreate the pvc when a pvc is deleted before a pod #79164
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cwdsuzhou The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
95a77fd
to
53d8d09
Compare
/test pull-kubernetes-integration |
/test pull-kubernetes-kubemark-e2e-gce-big |
53d8d09
to
dd7c1ae
Compare
@@ -192,6 +192,11 @@ func (spc *realStatefulPodControl) createPersistentVolumeClaims(set *apps.Statef | |||
case err != nil: | |||
errs = append(errs, fmt.Errorf("Failed to retrieve PVC %s: %s", claim.Name, err)) | |||
spc.recordClaimEvent("create", set, pod, &claim, err) | |||
case err == 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.
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.
Since this is not an atomic operation, I think creating statefulSet pod can not avoid the scene absolutely. However, it seldom(almost never) would happen.
Why not just add a watch on PVCs and check if a deleted PVC corresponds to a Pod in a StatefulSet that has not been deleted? |
I am not sure if this would increase api-server load. So I would like to fix the issue by check DeleteTimeStamp I have corrected the logic of this PR:
we should also mark it as error. PATL, thanks @kow3ns |
cc @janetkuo PTAL, thanks. |
/priority important-longterm |
/retest |
908f749
to
a3f52d1
Compare
/assign @janetkuo |
ping @janetkuo PTAL thanks |
// if get pvc failed collect it; | ||
// if not found or in terminating also collect error; | ||
// if found pvc and not in terminating state, do not collect it. | ||
actualPVC, getErr := spc.client.CoreV1().PersistentVolumeClaims(claim.Namespace).Get(claim.Name, |
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 don't see why rechecking the deletionTimestamp by live GET helps here. The same object may not transition back and you get race on detecting the recreate case where you can miss it so we'd need a reconciliation logic for that case anyways.
Watching if pods reference deleted PVC and reconciling it as @kow3ns suggested in #79164 (comment) sounds more reliable
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 don't see why rechecking the deletionTimestamp by live GET helps here. The same object may not transition back and you get race on detecting the recreate case where you can miss it so we'd need a reconciliation logic for that case anyways.
Watching if pods reference deleted PVC and reconciling it as @kow3ns suggested in #79164 (comment) sounds more reliable
Thanks, I would do that later
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Hi, How about this pr status? |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closed this PR. In response to this:
Instructions 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/test-infra repository. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Currently, statefulSet would not recreate the pvc when a pvc is deleted before a pod, which would lead to pod in pending status.
Which issue(s) this PR fixes:
Fixes #74374
Special notes for your reviewer:
Does this PR introduce a user-facing change?: