kubernetes-csi / external-resizer

Sidecar container that watches Kubernetes PersistentVolumeClaims objects and triggers controller side expansion operation against a CSI endpoint
Apache License 2.0
126 stars 130 forks source link

pvc does not change after pv expansion #225

Closed lijhnihaoa closed 1 year ago

lijhnihaoa commented 2 years ago

I1028 10:56:46.042219 1 controller.go:295] Started PVC processing "kube-csi/1369-csi-pvc-1" I1028 10:56:46.052299 1 connection.go:183] GRPC call: /csi.v1.Controller/ControllerGetCapabilities I1028 10:56:46.052311 1 connection.go:184] GRPC request: {} I1028 10:56:46.052452 1 event.go:285] Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"kube-csi", Name:"1369-csi-pvc-1", UID:"d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9", APIVersion:"v1", ResourceVersion:"3528288", FieldPath:""}): type: 'Normal' reason: 'Resizing' External resizer is resizing volume pvc-d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9 I1028 10:56:46.053139 1 connection.go:186] GRPC response: {"capabilities":[{"Type":{"Rpc":{"type":1}}},{"Type":{"Rpc":{"type":5}}},{"Type":{"Rpc":{"type":9}}},{"Type":{"Rpc":{"type":7}}}]} I1028 10:56:46.053275 1 connection.go:187] GRPC error: <nil> I1028 10:56:46.053305 1 connection.go:183] GRPC call: /csi.v1.Controller/ControllerExpandVolume I1028 10:56:46.053314 1 connection.go:184] GRPC request: {"capacity_range":{"required_bytes":536870912},"volume_capability":{"AccessType":{"Mount":{"fs_type":"ext4"}},"access_mode":{"mode":1}},"volume_id":"10.15.22.140:8008nvme.tcp-20b89655-5ee9-4516-9ae5-659e4671f257"} I1028 10:56:46.063293 1 connection.go:186] GRPC response: {"capacity_bytes":536870912,"node_expansion_required":true} I1028 10:56:46.063348 1 connection.go:187] GRPC error: <nil> I1028 10:56:46.063357 1 controller.go:483] Resize volume succeeded for volume "pvc-d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9", start to update PV's capacity I1028 10:56:46.063366 1 controller.go:590] Resize volume succeeded for volume "pvc-d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9", start to update PV's capacity I1028 10:56:46.066785 1 controller.go:489] Update capacity of PV "pvc-d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9" to 512Mi succeeded I1028 10:56:46.070404 1 controller.go:511] Mark PVC "kube-csi/1369-csi-pvc-1" as file system resize required I1028 10:56:46.070459 1 controller.go:295] Started PVC processing "kube-csi/1369-csi-pvc-1" I1028 10:56:46.070474 1 controller.go:352] No need to resize PV "pvc-d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9" I1028 10:56:46.070494 1 controller.go:295] Started PVC processing "kube-csi/1369-csi-pvc-1" I1028 10:56:46.070515 1 controller.go:352] No need to resize PV "pvc-d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9" I1028 10:56:46.070519 1 event.go:285] Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"kube-csi", Name:"1369-csi-pvc-1", UID:"d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9", APIVersion:"v1", ResourceVersion:"3528288", FieldPath:""}): type: 'Normal' reason: 'FileSystemResizeRequired' Require file system resize of volume on node

lijhnihaoa commented 2 years ago

NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE kube-csi 1369-csi-pvc-1 Bound pvc-d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9 128Mi RWO spdkcsi-sc-nvme 3h30m [root@compute1 v1-1369]# kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-d40c53c6-5d61-4c01-80d8-0d2b9f60d5f9 512Mi RWO Delete Bound kube-csi/1369-csi-pvc-1 spdkcsi-sc-nvme 3h30m

lijhnihaoa commented 2 years ago

pkg/controller/controller.go err := func() error { newSize, fsResizeRequired, err := ctrl.resizeVolume(pvc, pv) if err != nil { return err } if fsResizeRequired { // Resize volume succeeded and need to resize file system by kubelet, mark it as file system resizing required. return ctrl.markPVCAsFSResizeRequired(pvc) } // Resize volume succeeded and no need to resize file system by kubelet, mark it as resizing finished. return ctrl.markPVCResizeFinished(pvc, newSize) }()

Why not use ctrl.markPVCResizeFinished(pvc, newSize), ctrl.markPVCAsFSResizeRequired(pvc) did not change the volume of PVC

gnufied commented 2 years ago

Can you explain in some detail, what you were doing and what happened and what you were expecting to happen? It is little bit hard to decipher underlying bug from just the error messages.

lijhnihaoa commented 2 years ago

I'm sorry, I looked at the code carefully and found that if NodeExpandVolume is not required, the parameter NodeExpansionRequired needs to be passed to false in order to talk about the size of the pvc synchronously

gnufied commented 1 year ago

Yea that is correct. if no node expansion is required for the volume, CSI driver must return false as return value and in which case pvc size should be updated completely solely after controller expansion.

Please close the bug, if this worked as expected.

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 1 year ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes-csi/external-resizer/issues/225#issuecomment-1500972366): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.