Skip to content

Commit

Permalink
Merge pull request #59 from joy717/fix/required-bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislusf authored Apr 15, 2022
2 parents 5cffc07 + 15f316b commit c2ec139
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
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

0 comments on commit c2ec139

Please sign in to comment.