support configurable cache size
fix https://github.com/seaweedfs/seaweedfs-csi-driver/issues/20
This commit is contained in:
parent
177fdf0ea0
commit
40fa2802eb
@ -16,6 +16,7 @@ var (
|
|||||||
nodeID = flag.String("nodeid", "", "node id")
|
nodeID = flag.String("nodeid", "", "node id")
|
||||||
version = flag.Bool("version", false, "Print the version and exit.")
|
version = flag.Bool("version", false, "Print the version and exit.")
|
||||||
concurrentWriters = flag.Int("concurrentWriters", 32, "limit concurrent goroutine writers if not 0")
|
concurrentWriters = flag.Int("concurrentWriters", 32, "limit concurrent goroutine writers if not 0")
|
||||||
|
cacheSizeMB = flag.Int64("cacheCapacityMB", 1000, "local file chunk cache capacity in MB (0 will disable cache)")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -35,5 +36,6 @@ func main() {
|
|||||||
|
|
||||||
drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint)
|
drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint)
|
||||||
drv.ConcurrentWriters = *concurrentWriters
|
drv.ConcurrentWriters = *concurrentWriters
|
||||||
|
drv.CacheSizeMB = *cacheSizeMB
|
||||||
drv.Run()
|
drv.Run()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -297,6 +297,7 @@ spec:
|
|||||||
- "--endpoint=$(CSI_ENDPOINT)"
|
- "--endpoint=$(CSI_ENDPOINT)"
|
||||||
- "--filer=$(SEAWEEDFS_FILER)"
|
- "--filer=$(SEAWEEDFS_FILER)"
|
||||||
- "--nodeid=$(NODE_ID)"
|
- "--nodeid=$(NODE_ID)"
|
||||||
|
- "--cacheCapacityMB=$(SEAWEEDFS_CACHE_CAPACITY_MB)"
|
||||||
env:
|
env:
|
||||||
- name: CSI_ENDPOINT
|
- name: CSI_ENDPOINT
|
||||||
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
|
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
|
||||||
@ -306,6 +307,8 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: spec.nodeName
|
fieldPath: spec.nodeName
|
||||||
|
- name: SEAWEEDFS_CACHE_CAPACITY_MB
|
||||||
|
value: "1000"
|
||||||
imagePullPolicy: "Always"
|
imagePullPolicy: "Always"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: socket-dir
|
- name: socket-dir
|
||||||
@ -365,6 +368,7 @@ spec:
|
|||||||
- "--endpoint=$(CSI_ENDPOINT)"
|
- "--endpoint=$(CSI_ENDPOINT)"
|
||||||
- "--filer=$(SEAWEEDFS_FILER)"
|
- "--filer=$(SEAWEEDFS_FILER)"
|
||||||
- "--nodeid=$(NODE_ID)"
|
- "--nodeid=$(NODE_ID)"
|
||||||
|
- "--cacheCapacityMB=$(SEAWEEDFS_CACHE_CAPACITY_MB)"
|
||||||
env:
|
env:
|
||||||
- name: CSI_ENDPOINT
|
- name: CSI_ENDPOINT
|
||||||
value: unix:///csi/csi.sock
|
value: unix:///csi/csi.sock
|
||||||
@ -374,6 +378,8 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: spec.nodeName
|
fieldPath: spec.nodeName
|
||||||
|
- name: SEAWEEDFS_CACHE_CAPACITY_MB
|
||||||
|
value: "1000"
|
||||||
imagePullPolicy: "IfNotPresent"
|
imagePullPolicy: "IfNotPresent"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: plugin-dir
|
- name: plugin-dir
|
||||||
|
|||||||
@ -38,6 +38,7 @@ type SeaweedFsDriver struct {
|
|||||||
filer string
|
filer string
|
||||||
grpcDialOption grpc.DialOption
|
grpcDialOption grpc.DialOption
|
||||||
ConcurrentWriters int
|
ConcurrentWriters int
|
||||||
|
CacheSizeMB int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSeaweedFsDriver(filer, nodeID, endpoint string) *SeaweedFsDriver {
|
func NewSeaweedFsDriver(filer, nodeID, endpoint string) *SeaweedFsDriver {
|
||||||
|
|||||||
@ -36,6 +36,7 @@ func (seaweedFs *seaweedFsMounter) Mount(target string) error {
|
|||||||
fmt.Sprintf("-collection=%s", seaweedFs.bucketName),
|
fmt.Sprintf("-collection=%s", seaweedFs.bucketName),
|
||||||
fmt.Sprintf("-filer=%s", seaweedFs.driver.filer),
|
fmt.Sprintf("-filer=%s", seaweedFs.driver.filer),
|
||||||
fmt.Sprintf("-filer.path=/buckets/%s", seaweedFs.bucketName),
|
fmt.Sprintf("-filer.path=/buckets/%s", seaweedFs.bucketName),
|
||||||
|
fmt.Sprintf("-cacheCapacityMB=%d", seaweedFs.driver.CacheSizeMB),
|
||||||
}
|
}
|
||||||
|
|
||||||
for arg, value := range seaweedFs.volContext {
|
for arg, value := range seaweedFs.volContext {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user