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 f31247e commit 3e5c8f5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions charts/rclone-copy/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ kind: ConfigMap
metadata:
name: rclone-config-{{ .Release.Name }}
data:
{{- if not .Values.secretConfig }}
rclone.conf: |
{{ .Values.rcloneConf | indent 4 }}
{{- end }}
include-pattern.conf: |
{{ .Values.includePattern | indent 4 }}
12 changes: 9 additions & 3 deletions charts/rclone-copy/templates/rclone-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ spec:
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:
{{- if .Values.secretConfig }}
- name: secret-config
{{- else }}
- name: config
{{- end }}
# This is the default path where the rclone implementation assumes the config is located
mountPath: "/root/.config/rclone/rclone_ro.conf"
subPath: "rclone.conf"
- name: include-config
- name: config
mountPath: "/root/include-pattern.conf"
subPath: "include-pattern.conf"

Expand All @@ -100,10 +104,12 @@ spec:

restartPolicy: {{ .Values.restartPolicy }}
volumes:
- name: config
{{- if .Values.secretConfig }}
- name: secret-config
secret:
secretName: rclone-config-{{ .Release.Name }}
- name: include-config
{{- end }}
- name: config
configMap:
name: rclone-config-{{ .Release.Name }}
backoffLimit: {{ .Values.backoffLimit }}
4 changes: 4 additions & 0 deletions charts/rclone-copy/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if or .Values.configPassword .Values.secretConfig }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -7,4 +8,7 @@ data:
{{- if .Values.configPassword }}
password: {{ .Values.configPassword | b64enc }}
{{- end }}
{{- if .Values.secretConfig }}
rclone.conf: {{ .Values.rcloneConf | b64enc }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/rclone-copy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ secretRefs: {}
# RCLONE_CONFIG_PASS:
# name: secretName
# key: secretKey

secretConfig: false

0 comments on commit 3e5c8f5

Please sign in to comment.