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")
|
||||
version = flag.Bool("version", false, "Print the version and exit.")
|
||||
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() {
|
||||
@ -35,5 +36,6 @@ func main() {
|
||||
|
||||
drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint)
|
||||
drv.ConcurrentWriters = *concurrentWriters
|
||||
drv.CacheSizeMB = *cacheSizeMB
|
||||
drv.Run()
|
||||
}
|
||||
|
||||
@ -297,6 +297,7 @@ spec:
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
- "--filer=$(SEAWEEDFS_FILER)"
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--cacheCapacityMB=$(SEAWEEDFS_CACHE_CAPACITY_MB)"
|
||||
env:
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
|
||||
@ -306,6 +307,8 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: SEAWEEDFS_CACHE_CAPACITY_MB
|
||||
value: "1000"
|
||||
imagePullPolicy: "Always"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
@ -365,6 +368,7 @@ spec:
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
- "--filer=$(SEAWEEDFS_FILER)"
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--cacheCapacityMB=$(SEAWEEDFS_CACHE_CAPACITY_MB)"
|
||||
env:
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix:///csi/csi.sock
|
||||
@ -374,6 +378,8 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: SEAWEEDFS_CACHE_CAPACITY_MB
|
||||
value: "1000"
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
|
||||
@ -38,6 +38,7 @@ type SeaweedFsDriver struct {
|
||||
filer string
|
||||
grpcDialOption grpc.DialOption
|
||||
ConcurrentWriters int
|
||||
CacheSizeMB int64
|
||||
}
|
||||
|
||||
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("-filer=%s", seaweedFs.driver.filer),
|
||||
fmt.Sprintf("-filer.path=/buckets/%s", seaweedFs.bucketName),
|
||||
fmt.Sprintf("-cacheCapacityMB=%d", seaweedFs.driver.CacheSizeMB),
|
||||
}
|
||||
|
||||
for arg, value := range seaweedFs.volContext {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user