seaweedfs / seaweedfs-csi-driver

SeaweedFS CSI Driver https://github.com/seaweedfs/seaweedfs
Apache License 2.0
210 stars 50 forks source link

Resize not updating spec.csi.volumeAttributes.volumeCapacity #126

Closed Ruakij closed 1 month ago

Ruakij commented 1 year ago

I had created a volume via PVC too small. So i increased its size and made sure the Resizer changed everything.

Both, the PVC and PV now have the correct spec.capacity.storage, but the PV didnt have its field spec.csi.volumeAttributes.volumeCapacity updated. This field is used by the driver to set the quota, so the resize effectively only worked on paper, but the mount has the same virtual limit set.

The resizer claims the resize was a success.

I0705 19:41:22.803622       1 controller.go:295] Started PVC processing "app/data-claim"
I0705 19:41:22.820468       1 controller.go:483] Resize volume succeeded for volume "pvc-401371c4-00dd-4e3f-a50c-88efa6d430a7", start to update PV's capacity
I0705 19:41:22.820486       1 controller.go:590] Resize volume succeeded for volume "pvc-401371c4-00dd-4e3f-a50c-88efa6d430a7", start to update PV's capacity
I0705 19:41:22.820510       1 event.go:285] Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"app", Name:"data-claim", UID:"401371c4-00dd-4e3f-a50c-88efa6d430a7", APIVersion:"v1", ResourceVersion:"5828831", FieldPath:""}): type: 'Normal' reason: 'Resizing' External resizer is resizing volume pvc-401371c4-00dd-4e3f-a50c-88efa6d430a7
I0705 19:41:22.852613       1 controller.go:489] Update capacity of PV "pvc-401371c4-00dd-4e3f-a50c-88efa6d430a7" to 20Gi succeeded
I0705 19:41:22.916560       1 controller.go:511] Mark PVC "app/data-claim" as file system resize required
I0705 19:41:22.916600       1 controller.go:295] Started PVC processing "app/data-claim"
I0705 19:41:22.916616       1 controller.go:352] No need to resize PV "pvc-401371c4-00dd-4e3f-a50c-88efa6d430a7"
I0705 19:41:22.916623       1 event.go:285] Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"matrix-app", Name:"data-claim", UID:"401371c4-00dd-4e3f-a50c-88efa6d430a7", APIVersion:"v1", ResourceVersion:"5828831", FieldPath:""}): type: 'Normal' reason: 'FileSystemResizeRequired' Require file system resize of volume on node
I0705 19:41:22.916766       1 controller.go:295] Started PVC processing "app/data-claim"
I0705 19:41:22.916782       1 controller.go:352] No need to resize PV "pvc-401371c4-00dd-4e3f-a50c-88efa6d430a7"

Steps to reproduce:

  1. Create generic PVC
  2. Increase PVC storage request
  3. Wait for resizer to work (usually requires re/scheduling a pod, even if none were scheduled/running before)
  4. Check config for PV, see spec.csi.volumeAttributes.volumeCapacity on old value.
geekboood commented 9 months ago

I encountered the same issue. Do we have a solution here?

Ruakij commented 9 months ago

I encountered the same issue. Do we have a solution here?

Well you can create a new PV (or let one create from PVC) and rename the old folder in /buckets to the new one. (e.g. via filer) I think thats all you can really do to solve this at the moment.

duanhongyi commented 8 months ago

The best solution is not to transfer capacity through volumeAttributes, but to obtain capacity from the k8s API through volumeID; Otherwise, after the container is remounted, the capacity before expansion will be restored.

I will submit a PR to fix this issue later.

duanhongyi commented 8 months ago

150

duanhongyi commented 1 month ago

@chrislusf This issue can be closed now