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

feat: add MaxVolumesPerNode setting #242

Merged
merged 5 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions helm/templates/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ spec:
value: "true"
- name: ISSUE_MESSAGE_FILE
value: "true"
- name: MAX_VOLUMES_PERNODE
value: "{{ .Values.agent.max_volumes_pre_node }}"
dongjiang1989 marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.global.YodaSchedulerSvcIP }}
- name: EXTENDER_SVC_IP
value: "{{ .Values.global.YodaSchedulerSvcIP }}"
Expand Down
1 change: 1 addition & 0 deletions helm/values-acka.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ agent:
volume_name_prefix: yoda
spdk: false
driverMode: node
max_volumes_pre_node: 256
dongjiang1989 marked this conversation as resolved.
Show resolved Hide resolved
extender:
name: yoda-scheduler-extender
# scheduling strategy: binpack/spread
Expand Down
1 change: 1 addition & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ agent:
# all: agent will start as csi controller and csi node
# node: agent will start as csi node
driverMode: node
max_volumes_pre_node: 256
dongjiang1989 marked this conversation as resolved.
Show resolved Hide resolved
extender:
name: open-local-scheduler-extender
# scheduling strategy: binpack/spread
Expand Down
19 changes: 19 additions & 0 deletions pkg/csi/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,28 @@ type nodeServer struct {
spdkSupported bool
spdkclient *spdk.SpdkClient
osTool OSTool
maxVolumesPerNode int64

options *driverOptions
}

func newNodeServer(options *driverOptions) *nodeServer {
var maxVolumesNum int64 = DefaultMaxVolumesPerNode
volumeNum := os.Getenv("MAX_VOLUMES_PERNODE")
if volumeNum != "" {
num, err := strconv.ParseInt(volumeNum, 10, 64)
if err != nil {
log.Fatalf("NewNodeServer: MAX_VOLUMES_PERNODE must be int64, but get: %s", volumeNum)
dongjiang1989 marked this conversation as resolved.
Show resolved Hide resolved
} else {
if num < 0 || num > int64(MaxVolumesPerNodeLimited) {
log.Errorf("NewNodeServer: MAX_VOLUMES_PERNODE must between 0-%d, but get: %s", int64(MaxVolumesPerNodeLimited), volumeNum)
} else {
maxVolumesNum = num
log.Infof("NewNodeServer: MAX_VOLUMES_PERNODE is set to(not default): %d", maxVolumesNum)
}
}
}

store, err := NewVolumeStore(DefaultEphemeralVolumeDataFilePath)
if err != nil {
log.Fatalf("fail to initialize ephemeral volume store: %s", err.Error())
Expand All @@ -73,6 +90,7 @@ func newNodeServer(options *driverOptions) *nodeServer {
spdkSupported: false,
osTool: NewOSTool(),
options: options,
maxVolumesPerNode: maxVolumesNum,
}

if options.enableSpdk {
Expand Down Expand Up @@ -306,6 +324,7 @@ func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoReque
pkg.KubernetesNodeIdentityKey: ns.options.nodeID,
},
},
MaxVolumesPerNode: ns.maxVolumesPerNode,
}, nil
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/csi/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ const (
DirectTag = "direct"
// StripingType striping type
StripingType = "striping"
// DefaultMaxVolumesPerNode define default max volumes one node
dongjiang1989 marked this conversation as resolved.
Show resolved Hide resolved
DefaultMaxVolumesPerNode = 64
// MaxVolumesPerNodeLimited define limit max volumes one node
MaxVolumesPerNodeLimited = 1024
)

type CSIPlugin struct {
Expand Down
Loading