diff --git a/stable/influxdb/Chart.yaml b/stable/influxdb/Chart.yaml index 2cfd5c01ec..39aa3b5570 100755 --- a/stable/influxdb/Chart.yaml +++ b/stable/influxdb/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: influxdb -version: 1.3.4 +version: 1.4.0 appVersion: 1.7.6 description: Scalable datastore for metrics, events, and real-time analytics. keywords: diff --git a/stable/influxdb/templates/backup-cronjob.yaml b/stable/influxdb/templates/backup-cronjob.yaml index 619b3a1cd2..1ce5995706 100644 --- a/stable/influxdb/templates/backup-cronjob.yaml +++ b/stable/influxdb/templates/backup-cronjob.yaml @@ -25,12 +25,14 @@ spec: volumes: - name: backups emptyDir: {} + {{- if and .Values.backup.gcs }} - name: google-cloud-key secret: secretName: {{ .Values.backup.gcs.serviceAccountSecret | quote }} + {{- end }} initContainers: - name: influxdb-backup - image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" volumeMounts: - name: backups mountPath: /backups @@ -41,6 +43,7 @@ spec: - | influxd backup -host {{ template "influxdb.fullname" . }}.{{ .Release.Namespace }}.svc:{{ .Values.config.rpc.bind_address }} -portable /backups/backup_$(date +%Y%m%d_%H%M%S) containers: + {{- if .Values.backup.gcs}} - name: gsutil-cp image: google/cloud-sdk:alpine command: @@ -59,7 +62,34 @@ spec: - name: SRC_URL value: /backups - name: DST_URL - value: {{ .Values.backup.destination}} + value: {{ .Values.gcs.backup.destination}} - name: KEY_FILE value: /var/secrets/google/key.json + {{- end }} + {{- if .Values.backup.azure }} + - name: azure-cli + image: microsoft/azure-cli + command: + - /bin/sh + args: + - '-c' + - | + az storage container create --name "$DST_CONTAINER" + az storage blob upload-batch --destination "$DST_CONTAINER" --destination-path "$DST_PATH" --source "$SRC_URL" + volumeMounts: + - name: backups + mountPath: /backups + env: + - name: SRC_URL + value: /backups + - name: DST_CONTAINER + value: {{ .Values.backup.azure.destination_container }} + - name: DST_PATH + value: {{ .Values.backup.azure.destination_path }} + - name: AZURE_STORAGE_CONNECTION_STRING + valueFrom: + secretKeyRef: + name: {{ .Values.backup.azure.storageAccountSecret }} + key: connection-string + {{- end }} {{- end }} diff --git a/stable/influxdb/values.yaml b/stable/influxdb/values.yaml index 7a2278ad1c..50af432b50 100644 --- a/stable/influxdb/values.yaml +++ b/stable/influxdb/values.yaml @@ -280,7 +280,17 @@ backup: enabled: false schedule: "0 0 * * *" annotations: {} - destination: gs://bucket/influxdb - # Google Cloud Storage - gcs: - serviceAccountSecret: influxdb-backup-key + + ## Google Cloud Storage + ## Secret is expected to have key stored in `key.json` field + # gcs: + # serviceAccountSecret: influxdb-backup-key + # destination: gs://bucket/influxdb + + ## Azure + ## Secret is expected to have connection string stored in `connection-string` field + ## Existing container will be used or private one withing storage account will be created. + # azure: + # storageAccountSecret: influxdb-backup-azure-key + # destination_container: influxdb-container + # destination_path: ""