Skip to content

Commit

Permalink
Add flag to control config storage as secret (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 authored Dec 19, 2024
1 parent f31247e commit 1206673
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 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 }}
10 changes: 6 additions & 4 deletions charts/rclone-copy/templates/rclone-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ 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:
- name: config
- name: {{ .Values.secretConfig | ternary "secret-config" "config" }}
# 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 +100,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: true

0 comments on commit 1206673

Please sign in to comment.