Skip to content

Commit

Permalink
Add flag to control config storage as secret
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 committed Dec 18, 2024
1 parent 7f157a3 commit 8024f6c
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions 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 {{ if .Values.passwordSecret }}--password-command="echo $PASSWORD"{{ end }} {{ .Values.arguments | join " " }} --include-from /root/include-pattern.conf "{{ include "rclone-copy.getSourceOrUrl" . }}" "{{ .Values.sync.dest.name }}:{{ .Values.sync.dest.path }}"
rclone {{ .Values.command }} -v {{ if .Values.passwordSecret }}--password-command="cat /root/password"{{ end }} {{ .Values.arguments | join " " }} --include-from /root/include-pattern.conf "{{ include "rclone-copy.getSourceOrUrl" . }}" "{{ .Values.sync.dest.name }}:{{ .Values.sync.dest.path }}"
volumeMounts:
- name: {{ .Values.secretConfig | ternary "secret-config" "config" }}
Expand All @@ -76,11 +76,16 @@ spec:
- name: config
mountPath: "/root/include-pattern.conf"
subPath: "include-pattern.conf"
{{- if .Values.passwordSecret }}
- name: password
mountPath: "/root/password"
subPath: {{ .Values.passwordSecret.key | quote }}
{{- end }}

resources:
{{ toYaml .Values.resources | indent 14 }}

{{- if or .Values.configPassword .Values.secretRefs .Values.passwordSecret }}
{{- if or .Values.configPassword .Values.secretRefs }}
env:
{{- if .Values.configPassword }}
- name: RCLONE_CONFIG_PASS
Expand All @@ -96,13 +101,6 @@ spec:
name: {{ $value.name }}
key: "{{ $value.key }}"
{{- end }}
{{- if .Values.passwordSecret }}
- name: PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.passwordSecret.name }}
key: "{{ .Values.passwordSecret.key }}"
{{- end }}
{{- end }}

restartPolicy: {{ .Values.restartPolicy }}
Expand All @@ -115,4 +113,9 @@ spec:
- name: config
configMap:
name: rclone-config-{{ .Release.Name }}
{{- if .Values.passwordSecret }}
- name: password
secret:
secretName: {{ .Values.passwordSecret.name }}
{{- end }}
backoffLimit: {{ .Values.backoffLimit }}

0 comments on commit 8024f6c

Please sign in to comment.