diff --git a/pkg/driver/nodeserver.go b/pkg/driver/nodeserver.go index 616c79b..2b0463c 100644 --- a/pkg/driver/nodeserver.go +++ b/pkg/driver/nodeserver.go @@ -80,7 +80,10 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol } return nil, status.Error(codes.Internal, err.Error()) } - //k8s api get Capacity + + // In seaweedfs quota is not configured on seaweedfs servers. + // Quota is applied only per mount. + // Previously we used to cmdline parameter to apply it, but such way does not allow dynamic resizing. if capacity, err := k8s.GetVolumeCapacity(volumeID); err == nil { if err := volume.Quota(capacity); err != nil { return nil, err diff --git a/pkg/driver/volume.go b/pkg/driver/volume.go index ac0a80a..ab0dcd4 100644 --- a/pkg/driver/volume.go +++ b/pkg/driver/volume.go @@ -90,6 +90,11 @@ func (vol *Volume) Quota(sizeByte int64) error { } defer clientConn.Close() + // We can't create PV of zero size, so we're using quota of 1 byte to define no quota. + if sizeByte == 1 { + sizeByte = 0 + } + client := mount_pb.NewSeaweedMountClient(clientConn) _, err = client.Configure(context.Background(), &mount_pb.ConfigureRequest{ CollectionCapacity: sizeByte,