Commit 91458be3 authored by Naseem's avatar Naseem Committed by Kubernetes Prow Robot

[stable/influxdb] Add backups to GCS (#14134)

* Upgrade influxdb to 1.7.6 Signed-off-by: 's avatarNaseem <naseemkullah@gmail.com> * Add backups to GCS Signed-off-by: 's avatarNaseem <naseemkullah@gmail.com> * Proposed fixes Signed-off-by: 's avatarNaseem <naseemkullah@gmail.com>
parent 10b2c4b0
apiVersion: v1
name: influxdb
version: 1.2.1
version: 1.3.0
appVersion: 1.7.6
description: Scalable datastore for metrics, events, and real-time analytics.
keywords:
......
{{- if .Values.backup.enabled }}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ template "influxdb.fullname" . }}-backup
labels:
app: {{ template "influxdb.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
{{- toYaml .Values.backup.annotations | nindent 4 }}
spec:
schedule: {{.Values.backup.schedule | quote }}
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
metadata:
labels:
app: {{ template "influxdb.fullname" . }}
release: "{{ .Release.Name }}"
spec:
restartPolicy: OnFailure
volumes:
- name: backups
emptyDir: {}
- name: google-cloud-key
secret:
secretName: {{ .Values.backup.gcs.serviceAccountSecret | quote }}
initContainers:
- name: influxdb-backup
image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}"
volumeMounts:
- name: backups
mountPath: /backups
command:
- /bin/sh
args:
- '-c'
- |
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:
- name: gsutil-cp
image: google/cloud-sdk:alpine
command:
- /bin/sh
args:
- '-c'
- |
gcloud auth activate-service-account --key-file $KEY_FILE
gsutil -m cp -r "$SRC_URL" "$DST_URL"
volumeMounts:
- name: backups
mountPath: /backups
- name: google-cloud-key
mountPath: /var/secrets/google/
env:
- name: SRC_URL
value: /backups
- name: DST_URL
value: {{ .Values.backup.destination}}
- name: KEY_FILE
value: /var/secrets/google/key.json
{{- end }}
......@@ -262,3 +262,12 @@ initScripts:
scripts:
init.iql: |+
CREATE DATABASE "telegraf" WITH DURATION 30d REPLICATION 1 NAME "rp_30d"
backup:
enabled: false
schedule: "0 0 * * *"
annotations: {}
destination: gs://bucket/influxdb
# Google Cloud Storage
gcs:
serviceAccountSecret: influxdb-backup-key
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