Skip to content

Commit

Permalink
add logging for rclone background daemon (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius authored Feb 26, 2024
1 parent 53e5f6f commit fb889d0
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

v0.1.7
------

- add logging for rclone background daemon

v0.1.6
------

Expand Down
2 changes: 1 addition & 1 deletion deploy/chartpress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ charts:
- name: csi-rclone
imagePrefix: renku/
resetTag: ""
resetVersion: 0.1.6
resetVersion: 0.1.7
repo:
git: SwissDataScienceCenter/helm-charts
published: https://swissdatasciencecenter.github.io/helm-charts
Expand Down
4 changes: 2 additions & 2 deletions deploy/csi-rclone/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: csi-rclone
description: A Helm chart for the Rclone CSI
type: application
version: 0.1.6
appVersion: "0.1.6"
version: 0.1.7
appVersion: "0.1.7"
2 changes: 2 additions & 0 deletions deploy/csi-rclone/templates/csi-nodeplugin-rclone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
value: {{ quote .Values.kubernetesClusterDomain }}
- name: DRIVER_NAME
value: {{ .Values.storageClassName | quote}}
- name: LOG_LEVEL
value: {{ .Values.logLevel | default "NOTICE" | quote }}
image: {{ .Values.csiNodepluginRclone.rclone.image.repository }}:{{ .Values.csiNodepluginRclone.rclone.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.csiNodepluginRclone.rclone.imagePullPolicy }}
# TODO: check if necessary
Expand Down
1 change: 1 addition & 0 deletions deploy/csi-rclone/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ csiNodepluginRclone:
tolerations: []
affinity: {}
kubernetesClusterDomain: cluster.local
logLevel: NOTICE # Valid levels: DEBUG|INFO|NOTICE|ERROR
2 changes: 1 addition & 1 deletion devenv/nix/goModule.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
let
csiDriver = pkgs.buildGoModule {
pname = "csi-rclone-pvc-1";
version = "0.1.6";
version = "0.1.7";
src = ../../.;
vendorHash = "sha256-XY0XgDky2g7DQ210VsT+KKjyYL1EJPCNGP0F5GhY2gM=";
# CGO = 0;
Expand Down
12 changes: 9 additions & 3 deletions pkg/rclone/rclone.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,17 +320,22 @@ func (r *Rclone) run_daemon() error {
rclone_args = append(rclone_args, "--cache-info-age=72h")
rclone_args = append(rclone_args, "--cache-chunk-clean-interval=15m")
rclone_args = append(rclone_args, "--rc-no-auth")
rclone_args = append(rclone_args, "--log-file=/tmp/rclone.log")
loglevel := os.Getenv("LOG_LEVEL")
if len(loglevel) == 0 {
loglevel = "NOTICE"
}
rclone_args = append(rclone_args, fmt.Sprintf("--log-level=%s", loglevel))
rclone_args = append(rclone_args, fmt.Sprintf("--config=%s", f.Name()))
klog.Infof("running rclone remote control daemon cmd=%s, args=%s, ", rclone_cmd, rclone_args)

env := os.Environ()
cmd := os_exec.Command(rclone_cmd, rclone_args...)
stderr, err := cmd.StderrPipe()
stdout, err := cmd.StdoutPipe()
cmd.Stderr = cmd.Stdout
if err != nil {
panic("couldn't get stderr of rclone process")
}
scanner := bufio.NewScanner(stderr)
scanner := bufio.NewScanner(stdout)
cmd.Env = env
if err := cmd.Start(); err != nil {
return err
Expand All @@ -340,6 +345,7 @@ func (r *Rclone) run_daemon() error {
output := ""
for scanner.Scan() {
output = scanner.Text()
klog.Infof("rclone log: %s", output)
}
err := cmd.Wait()
if err != nil {
Expand Down

0 comments on commit fb889d0

Please sign in to comment.