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: use pv annotation to trigger filesystem resize when necessary #99326
Conversation
Welcome @sunpa93! |
Hi @sunpa93. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
/assign |
aab9820
to
b80b302
Compare
401594b
to
cc29214
Compare
/retest |
We can do this in a follow up but I think we should be able to test this with e2e and mock driver.
|
/test pull-kubernetes-unit |
…'s annotation that denotes the pre-resize capacity of the original pvc that pv was bound to if it has one test: confirm that pvc's status capacity is adjusted if pv has a pre-resize capacity annotation
/retest |
/priority important-soon |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsafrane, sunpa93 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 |
/retest |
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.
Sorry for the delayed review. I started reviewing the external-resizer one and came to this for some background.
General question. This annotation is alpha. What are our future plans for this? In general we have tried to move away from using alpha annotations because it's difficult to enforce alpha-level guarantees around them.
// AnnPreResizeCapacity annotation is added to a PV when expanding volume. | ||
// Its value is status capacity of the PVC prior to the volume expansion | ||
// Its value will be set by the external-resizer when it deems that filesystem resize is required after resizing volume. | ||
// Its value will be used by pv_controller to determine pvc's status capacity when binding pvc and pv. |
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.
Can you add a comment when the annotation is supposed to be removed?
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.
Will do :)
@@ -1551,6 +1551,14 @@ func (og *operationGenerator) GenerateExpandVolumeFunc( | |||
klog.Warning(detailedErr) | |||
return volumetypes.NewOperationContext(nil, nil, migrated) | |||
} | |||
oldCapacity := pvc.Status.Capacity[v1.ResourceStorage] | |||
err = util.AddAnnPreResizeCapacity(pv, oldCapacity, og.kubeClient) |
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 there a race here? Should the annotation be added before marking for fsresize?
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 can't think of scenarios where there can be a race from top of my head. Could you point to when race could happen?
What type of PR is this?
/kind bug
What this PR does / why we need it:
fix: when newly binding pvc to a pv, adjust pvc.status.capacity to pv's annotation that denotes the pre-resize capacity of the original pvc that pv was bound to if it has one
test: confirm that pvc's status capacity is adjusted if pv has a pre-resize capacity annotation
Which issue(s) this PR fixes:
Fixes #88683
Special notes for your reviewer:
This PR is a sister PR of kubernetes-csi/external-resizer#140
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: