Skip to content

Commit dc04c07

Browse files
authored
Merge pull request #587 from torredil/nodegetinfo-5123
Implement dynamic `MaxVolumesPerNode`
2 parents b0c4588 + 6b5e80f commit dc04c07

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/hostpath/nodeserver.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package hostpath
1818

1919
import (
2020
"fmt"
21+
"math/rand"
2122
"os"
2223
"strings"
2324

@@ -365,6 +366,11 @@ func (hp *hostPath) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest
365366
resp.MaxVolumesPerNode = hp.config.AttachLimit
366367
}
367368

369+
// if attach limit is -1, set a random MaxVolumesPerNode between 1 and 10
370+
if hp.config.AttachLimit == -1 {
371+
resp.MaxVolumesPerNode = int64(rand.Intn(10) + 1)
372+
}
373+
368374
return resp, nil
369375
}
370376

0 commit comments

Comments
 (0)