Skip to content

Commit 576c0d0

Browse files
Add extraArgs for rclone daemon configuration (#69)
Adds support for passing custom arguments to the rclone daemon via Helm chart configuration
1 parent 9fb826b commit 576c0d0

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

deploy/csi-rclone/templates/csi-nodeplugin-rclone.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ spec:
8282
value: {{ .Values.csiNodepluginRclone.rclone.cache.dir | quote }}
8383
- name: CACHE_SIZE
8484
value: {{ .Values.csiNodepluginRclone.rclone.cache.size | quote }}
85+
{{- if .Values.csiNodepluginRclone.rclone.extraArgs }}
86+
- name: EXTRA_ARGS
87+
value: {{ .Values.csiNodepluginRclone.rclone.extraArgs | toJson | quote }}
88+
{{- end }}
8589
{{- with .Values.csiNodepluginRclone.rclone.extraEnv }}
8690
{{- if . }}
8791
{{ toYaml . | nindent 8 }}

deploy/csi-rclone/values.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ csiControllerRclone:
1313
rclone:
1414
image:
1515
repository: csi-rclone
16-
tag: "latest"
16+
tag: latest
1717
imagePullPolicy: IfNotPresent
1818
resources:
1919
{}
@@ -40,7 +40,10 @@ csiNodepluginRclone:
4040
add:
4141
- SYS_ADMIN
4242
privileged: true
43+
# Extra environment variables for the rclone container
4344
extraEnv: []
45+
# - name: "DEBUG"
46+
# value: "true"
4447
image:
4548
repository: csi-rclone
4649
tag: "latest"
@@ -59,6 +62,12 @@ csiNodepluginRclone:
5962
dir: /var/lib/rclone/cache
6063
# The size allocated for the cache directory
6164
size: 1G
65+
# Extra arguments to pass to rclone daemon
66+
extraArgs: []
67+
# - name: "buffer-size"
68+
# value: "32M"
69+
# - name: "transfers"
70+
# value: "8"
6271
serviceAccount:
6372
annotations: {}
6473
nodeSelector: {}

pkg/rclone/rclone.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,22 @@ func (r *Rclone) start_daemon() error {
424424
if r.cacheDir != "" {
425425
rclone_args = append(rclone_args, fmt.Sprintf("--cache-dir=%s", r.cacheDir))
426426
}
427+
// Add any extra arguments from environment variable
428+
extraArgs := os.Getenv("EXTRA_ARGS")
429+
if extraArgs != "" {
430+
var argList []map[string]string
431+
if err := json.Unmarshal([]byte(extraArgs), &argList); err == nil {
432+
for _, arg := range argList {
433+
if name, exists := arg["name"]; exists && name != "" {
434+
if value, hasValue := arg["value"]; hasValue && value != "" {
435+
rclone_args = append(rclone_args, fmt.Sprintf("--%s=%s", name, value))
436+
} else {
437+
rclone_args = append(rclone_args, fmt.Sprintf("--%s", name))
438+
}
439+
}
440+
}
441+
}
442+
}
427443
loglevel := os.Getenv("LOG_LEVEL")
428444
if len(loglevel) == 0 {
429445
loglevel = "NOTICE"

0 commit comments

Comments
 (0)