Commit 2fdf877c authored by Tomasz Główka's avatar Tomasz Główka Committed by Kubernetes Prow Robot

[stable/influxdb] Add support for Azure to backup job (#16722)

parent 7a404866
apiVersion: v1 apiVersion: v1
name: influxdb name: influxdb
version: 1.3.4 version: 1.4.0
appVersion: 1.7.6 appVersion: 1.7.6
description: Scalable datastore for metrics, events, and real-time analytics. description: Scalable datastore for metrics, events, and real-time analytics.
keywords: keywords:
......
...@@ -25,12 +25,14 @@ spec: ...@@ -25,12 +25,14 @@ spec:
volumes: volumes:
- name: backups - name: backups
emptyDir: {} emptyDir: {}
{{- if and .Values.backup.gcs }}
- name: google-cloud-key - name: google-cloud-key
secret: secret:
secretName: {{ .Values.backup.gcs.serviceAccountSecret | quote }} secretName: {{ .Values.backup.gcs.serviceAccountSecret | quote }}
{{- end }}
initContainers: initContainers:
- name: influxdb-backup - name: influxdb-backup
image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
volumeMounts: volumeMounts:
- name: backups - name: backups
mountPath: /backups mountPath: /backups
...@@ -41,6 +43,7 @@ spec: ...@@ -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) 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: containers:
{{- if .Values.backup.gcs}}
- name: gsutil-cp - name: gsutil-cp
image: google/cloud-sdk:alpine image: google/cloud-sdk:alpine
command: command:
...@@ -59,7 +62,34 @@ spec: ...@@ -59,7 +62,34 @@ spec:
- name: SRC_URL - name: SRC_URL
value: /backups value: /backups
- name: DST_URL - name: DST_URL
value: {{ .Values.backup.destination}} value: {{ .Values.gcs.backup.destination}}
- name: KEY_FILE - name: KEY_FILE
value: /var/secrets/google/key.json 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 }} {{- end }}
...@@ -280,7 +280,17 @@ backup: ...@@ -280,7 +280,17 @@ backup:
enabled: false enabled: false
schedule: "0 0 * * *" schedule: "0 0 * * *"
annotations: {} annotations: {}
destination: gs://bucket/influxdb
# Google Cloud Storage ## Google Cloud Storage
gcs: ## Secret is expected to have key stored in `key.json` field
serviceAccountSecret: influxdb-backup-key # 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: ""
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