Unverified Commit 3b23722d authored by Daniel Trojanowski's avatar Daniel Trojanowski Committed by GitHub

InfluxDB backup to Amazon S3 (or compatible) (#123)

Co-authored-by: 's avatarNaseem <naseem@transit.app>
parent f684e837
apiVersion: v1
name: influxdb
version: 4.7.2
version: 4.8.0
appVersion: 1.8.0
description: Scalable datastore for metrics, events, and real-time analytics.
keywords:
......
......@@ -101,6 +101,7 @@ The following table lists configurable parameters, their descriptions, and their
| backup.enabled | Enable backups, if `true` must configure one of the storage providers | `false` |
| backup.gcs | Google Cloud Storage config | `nil`
| backup.azure | Azure Blob Storage config | `nil`
| backup.s3 | Amazon S3 (or compatible) config | `nil`
| backup.schedule | Schedule to run jobs in cron format | `0 0 * * *` |
| backup.annotations | Annotations for backup cronjob | {} |
| backup.podAnnotations | Annotations for backup cronjob pods | {} |
......
......@@ -38,6 +38,13 @@ spec:
secretName: {{ .Values.backup.gcs.serviceAccountSecret | quote }}
{{- end }}
{{- end }}
{{- if .Values.backup.s3 }}
{{- if .Values.backup.s3.credentialsSecret }}
- name: aws-credentials-secret
secret:
secretName: {{ .Values.backup.s3.credentialsSecret | quote }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "influxdb.serviceAccountName" . }}
initContainers:
- name: influxdb-backup
......@@ -113,4 +120,30 @@ spec:
resources:
{{- toYaml .Values.backup.resources | nindent 14 }}
{{- end }}
{{- if .Values.backup.s3 }}
- name: aws-cli
image: amazon/aws-cli
command:
- /bin/sh
args:
- '-c'
- |
aws {{- if .Values.backup.s3.endpointUrl }} --endpoint-url={{ .Values.backup.s3.endpointUrl }} {{- end }} s3 cp --recursive "$SRC_URL" "$DST_URL"
volumeMounts:
- name: backup
mountPath: /backup
{{- if .Values.backup.s3.credentialsSecret}}
- name: aws-credentials-secret
mountPath: /var/secrets/aws/
{{- end }}
env:
- name: AWS_CONFIG_FILE
value: /var/secrets/aws/credentials
- name: SRC_URL
value: /backup
- name: DST_URL
value: {{ .Values.backup.s3.destination }}
resources:
{{- toYaml .Values.backup.resources | nindent 14 }}
{{- end }}
{{- end }}
......@@ -283,3 +283,14 @@ backup:
# storageAccountSecret: influxdb-backup-azure-key
# destination_container: influxdb-container
# destination_path: ""
## Amazon S3 or compatible
## Secret is expected to have AWS (or compatible) credentials stored in `credentials` field.
## Please look at https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-where
## for the credentials format.
## The bucket should already exist.
# s3:
# credentialsSecret: aws-credentials-secret
# destination: s3://bucket/path
# ## Optional. Specify if you're using an alternate S3 endpoint.
# # endpointUrl: ""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment