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

fix VolumeExpansion not work #59

Merged
merged 1 commit into from
Apr 15, 2022
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
6 changes: 6 additions & 0 deletions deploy/helm/seaweedfs-csi-driver/templates/rbac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ rules:
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: [ "" ]
resources: [ "persistentvolumeclaims/status" ]
verbs: [ "get", "list", "watch", "update", "patch" ]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
Expand All @@ -25,6 +28,9 @@ rules:
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["get", "list"]
- apiGroups: [ "" ]
resources: [ "pods" ]
verbs: [ "get", "list", "watch" ]

---
kind: ClusterRoleBinding
Expand Down
16 changes: 16 additions & 0 deletions deploy/helm/seaweedfs-csi-driver/templates/statefulset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ spec:
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
# resizer
- name: csi-resizer
image: {{ .Values.csiResizer.image }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
- "--leader-election=false"
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
imagePullPolicy: {{ .Values.imagePullPolicy }}
resources:
{{ toYaml .Values.csiAttacher.resources | nindent 12 }}
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
# SeaweedFs Plugin
- name: seaweedfs-csi-plugin
image: {{.Values.seaweedfsCsiPlugin.image}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ metadata:
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
provisioner: {{ .Values.driverName }}
allowVolumeExpansion: true
{{- end }}
4 changes: 4 additions & 0 deletions deploy/helm/seaweedfs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ csiAttacher:
image: k8s.gcr.io/sig-storage/csi-attacher:v3.4.0
resources: {}

csiResizer:
image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0
resources: {}

csiNodeDriverRegistrar:
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.5.0
resources: {}
Expand Down
4 changes: 2 additions & 2 deletions pkg/driver/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi

client := mount_pb.NewSeaweedMountClient(clientConn)
_, err = client.Configure(context.Background(), &mount_pb.ConfigureRequest{
CollectionCapacity: req.CapacityRange.LimitBytes,
CollectionCapacity: req.CapacityRange.RequiredBytes,
})

return &csi.ControllerExpandVolumeResponse{
CapacityBytes: req.CapacityRange.LimitBytes,
CapacityBytes: req.CapacityRange.RequiredBytes,
}, err

}
Expand Down
7 changes: 4 additions & 3 deletions pkg/driver/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ func (ns *NodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetC
Type: &csi.NodeServiceCapability_Rpc{
Rpc: &csi.NodeServiceCapability_RPC{
// Type: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
Type: csi.NodeServiceCapability_RPC_UNKNOWN,
//Type: csi.NodeServiceCapability_RPC_UNKNOWN,
Type: csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
},
},
},
Expand Down Expand Up @@ -181,11 +182,11 @@ func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV

client := mount_pb.NewSeaweedMountClient(clientConn)
_, err = client.Configure(context.Background(), &mount_pb.ConfigureRequest{
CollectionCapacity: req.CapacityRange.LimitBytes,
CollectionCapacity: req.CapacityRange.RequiredBytes,
})

return &csi.NodeExpandVolumeResponse{
CapacityBytes: req.CapacityRange.LimitBytes,
CapacityBytes: req.CapacityRange.RequiredBytes,
}, err
}

Expand Down