Unverified Commit 5fb994f0 authored by alespour's avatar alespour Committed by GitHub

[influxdb] fix backup job (#462)

* fix optional parameter handling * add backup job node selector support * bump version * Fix indenting Co-authored-by: 's avatarPavel Závora <pavel.zavora@bonitoo.io> * Fixed indenting more
parent 3219dd54
apiVersion: v1 apiVersion: v1
name: influxdb name: influxdb
version: 4.11.0 version: 4.12.0
appVersion: 1.8.10 appVersion: 1.8.10
description: Scalable datastore for metrics, events, and real-time analytics. description: Scalable datastore for metrics, events, and real-time analytics.
keywords: keywords:
......
...@@ -13,12 +13,15 @@ set -e ...@@ -13,12 +13,15 @@ set -e
# Sanity check to avoid removing all backups. # Sanity check to avoid removing all backups.
[[ "$DAYS_TO_RETAIN" -lt 1 ]] && DAYS_TO_RETAIN=1 [[ "$DAYS_TO_RETAIN" -lt 1 ]] && DAYS_TO_RETAIN=1
# Prepare endpoint-url argument
[[ -z "$S3_ENDPOINT" ]] && endpoint_arg="" || endpoint_arg="--endpoint-url ${S3_ENDPOINT}"
function get_records { function get_records {
before_date="$1" before_date="$1"
aws s3api list-objects \ aws s3api list-objects \
--bucket ${S3_BUCKET} \ --bucket ${S3_BUCKET} \
--endpoint-url ${S3_ENDPOINT} \ ${endpoint_arg} \
--query "Contents[?LastModified<='${before_date}'][].{Key: Key}" --query "Contents[?LastModified<='${before_date}'][].{Key: Key}"
} }
...@@ -56,7 +59,7 @@ function remove_old_backups { ...@@ -56,7 +59,7 @@ function remove_old_backups {
for path in "${del_paths[@]::${num_to_delete}}"; do for path in "${del_paths[@]::${num_to_delete}}"; do
aws s3 rm "s3://${S3_BUCKET}/${path}" \ aws s3 rm "s3://${S3_BUCKET}/${path}" \
--endpoint-url "${S3_ENDPOINT}" ${endpoint_arg}
done done
} }
......
...@@ -28,6 +28,10 @@ spec: ...@@ -28,6 +28,10 @@ spec:
{{- include "influxdb.selectorLabels" . | nindent 12 }} {{- include "influxdb.selectorLabels" . | nindent 12 }}
spec: spec:
restartPolicy: OnFailure restartPolicy: OnFailure
{{- with .Values.backup.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes: volumes:
- name: backup - name: backup
{{- if .Values.backup.persistence.enabled }} {{- if .Values.backup.persistence.enabled }}
......
...@@ -262,20 +262,21 @@ backup: ...@@ -262,20 +262,21 @@ backup:
startingDeadlineSeconds: "" startingDeadlineSeconds: ""
annotations: {} annotations: {}
podAnnotations: {} podAnnotations: {}
nodeSelector: {}
## Google Cloud Storage ## Google Cloud Storage
# gcs: # gcs:
# serviceAccountSecret: influxdb-backup-key # serviceAccountSecret: influxdb-backup-key
# serviceAccountSecretKey: key.json # serviceAccountSecretKey: key.json
# destination: gs://bucket/influxdb # destination: gs://bucket/influxdb
## Azure ## Azure
## Secret is expected to have connection string stored in `connection-string` field ## 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. ## Existing container will be used or private one withing storage account will be created.
# azure: # azure:
# storageAccountSecret: influxdb-backup-azure-key # storageAccountSecret: influxdb-backup-azure-key
# destination_container: influxdb-container # destination_container: influxdb-container
# destination_path: "" # destination_path: ""
## Amazon S3 or compatible ## Amazon S3 or compatible
## Secret is expected to have AWS (or compatible) credentials stored in `credentials` field. ## Secret is expected to have AWS (or compatible) credentials stored in `credentials` field.
...@@ -283,10 +284,10 @@ backup: ...@@ -283,10 +284,10 @@ backup:
## for the credentials format. ## for the credentials format.
## The bucket should already exist. ## The bucket should already exist.
# s3: # s3:
# credentialsSecret: aws-credentials-secret # credentialsSecret: aws-credentials-secret
# destination: s3://bucket/path # destination: s3://bucket/path
# ## Optional. Specify if you're using an alternate S3 endpoint. ## Optional. Specify if you're using an alternate S3 endpoint.
# # endpointUrl: "" # endpointUrl: ""
backupRetention: backupRetention:
enabled: false enabled: false
......
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