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

Use capacity of one byte as 'no quota' #159

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/driver/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions pkg/driver/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading