Skip to content
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 #140

Merged
merged 4 commits into from
May 4, 2021

Conversation

sunpa93
Copy link
Contributor

@sunpa93 sunpa93 commented Feb 23, 2021

What type of PR is this?
/kind bug

What this PR does / why we need it:
fix: add annotation to pv after resize if filesystem resize is necessary. delete when pvc.status.capacity >= pv.spec.capacity

Which issue(s) this PR fixes:

Fixes kubernetes/kubernetes#88683

Special notes for your reviewer:
This PR is a sister PR of kubernetes/kubernetes#99326

Does this PR introduce a user-facing change?:

Add a feature-gate to allow users to restore size of deleted PVCs

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 23, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @sunpa93!

It looks like this is your first PR to kubernetes-csi/external-resizer 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-csi/external-resizer has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 23, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @sunpa93. Thanks for your PR.

I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 23, 2021
@gnufied
Copy link
Contributor

gnufied commented Feb 23, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 23, 2021
@gnufied
Copy link
Contributor

gnufied commented Feb 23, 2021

/assign

Copy link
Contributor

@gnufied gnufied left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good mostly. But I think we need unit tests for some these new behaviours.

pkg/controller/controller.go Outdated Show resolved Hide resolved
pkg/controller/controller.go Outdated Show resolved Hide resolved
pkg/controller/controller.go Outdated Show resolved Hide resolved
pkg/controller/controller.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 25, 2021
@sunpa93
Copy link
Contributor Author

sunpa93 commented Feb 25, 2021

Looks good mostly. But I think we need unit tests for some these new behaviours.

I have modified the tests so that they check if annotations get properly populated and deleted

@gnufied
Copy link
Contributor

gnufied commented Mar 22, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 22, 2021
@gnufied
Copy link
Contributor

gnufied commented Apr 7, 2021

/assign @msau42

@@ -320,6 +321,16 @@ func (ctrl *resizeController) syncPVC(key string) error {
return fmt.Errorf("expected volume but got %+v", volumeObj)
}

if ctrl.isNodeExpandComplete(pvc, pv) && metav1.HasAnnotation(pv.ObjectMeta, util.AnnPreResizeCapacity) {
if err := ctrl.deletePreResizeCapAnnotation(pv); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come resize controller is deleting the annotation? Shouldn't kubelet do it after nodeexpand is complete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because kubelet does not have the permission to modify PV objects.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnufied is this an issue? Does this mean plugins that don't support controller resize and don't run the resizer will get this fix?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently I think external-resizer is required even for plugins that don't support controller expansion, because in that case external-resizer calls a NO-OP control-plane expansion and successfully expands the PV. There is no way to update PV spec from kubelet otherwise. So every plugin that supports expansion needs to run resizer.

jsafrane added a commit to jsafrane/external-resizer that referenced this pull request Apr 15, 2021
bc0504a Merge pull request kubernetes-csi#140 from jsafrane/remove-unused-k8s-libs
5b1de1a go-get-kubernetes.sh: remove unused k8s libs
49b4269 Merge pull request kubernetes-csi#120 from pohly/add-kubernetes-release
f7e7ee4 docs: steps for adding testing against new Kubernetes release

git-subtree-dir: release-tools
git-subtree-split: bc0504ad76ac6e20d0d7c60d46f62c7ff7591f8c
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 21, 2021
@k8s-ci-robot k8s-ci-robot removed the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 27, 2021
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 27, 2021
@Jiawei0227
Copy link
Contributor

Any updates on this? We are pending on csi-resizer release

@gnufied
Copy link
Contributor

gnufied commented Apr 30, 2021

Can you squash 4 last commits in one?

@sunpa93
Copy link
Contributor Author

sunpa93 commented Apr 30, 2021

Can you squash 4 last commits in one?

Done :)

@gnufied
Copy link
Contributor

gnufied commented Apr 30, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 30, 2021
@gnufied
Copy link
Contributor

gnufied commented May 4, 2021

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gnufied, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2021
@k8s-ci-robot k8s-ci-robot merged commit afddeb2 into kubernetes-csi:master May 4, 2021
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels May 5, 2021
dobsonj pushed a commit to dobsonj/external-resizer that referenced this pull request Oct 16, 2023
…ncy-openshift-4.14-ose-csi-external-resizer

Updating ose-csi-external-resizer images to be consistent with ART
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filesystem resize skipped if original PVC is deleted when FilesystemResizePending but PV is retained
5 participants