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

Support no secret for s3/ceph #1817

Merged
merged 7 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions charts/tidb-backup/templates/scripts/_start_backup.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,24 @@ uploader \
{{- end }}

{{- if .Values.s3 }}
uploader \
--cloud=aws \
--region={{ .Values.s3.region }} \
{{- if .Values.s3.prefix }}
--bucket={{ .Values.s3.bucket }}/{{ .Values.s3.prefix }} \
{{- else }}
--bucket={{ .Values.s3.bucket }} \
{{- end }}
--backup-dir=${dirname}
# Once we know there are no more credentials that will be logged we can run with -x
set -x
bucket={{ .Values.s3.bucket }}

cat <<EOF > /tmp/rclone.conf
[aws]
type = s3
provider = AWS
env_auth = true
region = us-west-2
EOF

cd "${backup_base_dir}"
{{- if .Values.s3.prefix }}
tar -cf - "${backup_name}" | pigz -p 16 \
| rclone --config /tmp/rclone.conf rcat s3:${bucket}/{{ .Values.s3.prefix }}/${backup_name}/${backup_name}.tgz
{{- else }}
tar -cf - "${backup_name}" | pigz -p 16 \
| rclone --config /tmp/rclone.conf rcat s3:${bucket}/${backup_name}/${backup_name}.tgz
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /gcp/credentials.json
{{- end }}
{{- if or .Values.scheduledBackup.ceph .Values.scheduledBackup.s3 }}
{{- if or .Values.scheduledBackup.ceph.secretName .Values.scheduledBackup.s3.secretName }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
Expand Down