Skip to content

Commit

Permalink
Allow specifying URL instead of sync source
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobEdding committed Aug 29, 2024
1 parent eca2821 commit 6b44e79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions charts/rclone-copy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ Create chart name and version as used by the chart label.
{{- define "rclone-copy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "rclone-copy.getSourceOrUrl" -}}
{{- if .Values.sync.url -}}
{{ .Values.sync.url -}}
{{- else -}}
{{ .Values.sync.source.name }}:{{ .Values.sync.source.path -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/rclone-copy/templates/rclone-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
# copy as workaround for rclone.conf read only (see https://github.com/rclone/rclone/issues/3655)
- >-
cp /root/.config/rclone/rclone_ro.conf /root/.config/rclone/rclone.conf &&
rclone {{ .Values.command }} -v {{ .Values.arguments | join " " }} --include-from /root/include-pattern.conf "{{ .Values.sync.source.name }}:{{ .Values.sync.source.path }}" "{{ .Values.sync.dest.name }}:{{ .Values.sync.dest.path }}"
rclone {{ .Values.command }} -v {{ .Values.arguments | join " " }} --include-from /root/include-pattern.conf "{{ include "rclone-copy.getSourceOrUrl" . }}" "{{ .Values.sync.dest.name }}:{{ .Values.sync.dest.path }}"
volumeMounts:
- name: config
Expand Down
3 changes: 3 additions & 0 deletions charts/rclone-copy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ sync:
# This is the path to the source directory.
path: /tmp/sync-dir

# Alternatively for the case of `rclone copyurl`, provide a URL instead of a source
url: https://example.com/myFileDownload

dest:
# This is the name for the destination remote from the rclone.conf file.
# If the value specified here is not present in the config file, the job will fail.
Expand Down

0 comments on commit 6b44e79

Please sign in to comment.