Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to control config storage as secret #12

Merged
merged 10 commits into from
Dec 19, 2024
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
Loading