[stable/mysqldump] option to run additional shell steps (#11100)

* add option for additional shell steps to run, fix kc alias in Notes.txt to kubectl

Signed-off-by: Norbert Varzariu <norbert.varzariu@lotto24.de>

* bump minor chart version, add example for additionalSteps

Signed-off-by: Norbert Varzariu <norbert.varzariu@lotto24.de>
This commit is contained in:
Norbert Varzariu
2019-02-03 10:33:58 -08:00
committed by Kubernetes Prow Robot
parent fd37371d69
commit 4c2ca4c38a
5 changed files with 22 additions and 7 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
apiVersion: v1
appVersion: 2.3.1
appVersion: 2.4.0
description: A Helm chart to help backup MySQL databases using mysqldump
name: mysqldump
version: 2.3.1
version: 2.4.0
keywords:
- mysql
- mysqldump
+1
View File
@@ -57,6 +57,7 @@ The following tables lists the configurable parameters of the mysqldump chart an
| schedule | crontab schedule to run on. set as `now` to run as a one time job | "0/5 \* \* \* \*" |
| options | options to pass onto MySQL | "--opt --single-transaction" |
| debug | print some extra debug logs during backup | false |
| additionalSteps | run these extra shell steps after all backup jobs completed | [] |
| successfulJobsHistoryLimit | number of successful jobs to remember | 5 |
| failedJobsHistoryLimit | number of failed jobs to remember | 5 |
| persistentVolumeClaim | existing Persistent Volume Claim to backup to, leave blank to create a new one | |
+5 -5
View File
@@ -10,7 +10,7 @@ $ kubectl get pods --selector=job-name={{ template "mysqldump.fullname" . }} --s
To see the logs from the backup job run:
$ kubectl logs `kc get pods --selector=job-name=test-mysqldump --output=jsonpath={.items..metadata.name}`
$ kubectl logs `kubectl get pods --selector=job-name=test-mysqldump --output=jsonpath={.items..metadata.name}`
mysqldump contents can be found in:
{{- if .Values.persistentVolumeClaim }}
@@ -19,7 +19,7 @@ $ kubectl get persistentvolumeclaim {{ .Values.persistentVolumeClaim }}
{{- if .Values.persistence.enabled }}
$ kubectl get persistentvolumeclaim {{ template "mysqldump.fullname" . }}
{{- else }}
$ kubectl logs `kc get pods --selector=job-name=test-mysqldump --output=jsonpath={.items..metadata.name}`
$ kubectl logs `kubectl get pods --selector=job-name=test-mysqldump --output=jsonpath={.items..metadata.name}`
{{- end -}}
{{- end }}
@@ -35,8 +35,8 @@ $ kubectl get jobs --selector=cronjob-name={{ template "mysqldump.fullname" . }}
To see the logs from the most recent backup job run:
$ kubectl logs $(kc get pods --selector \
job-name=$(kc get jobs --selector=cronjob-name={{ template "mysqldump.fullname" . }} \
$ kubectl logs $(kubectl get pods --selector \
job-name=$(kubectl get jobs --selector=cronjob-name={{ template "mysqldump.fullname" . }} \
--output=jsonpath='{.items[-1:].metadata.name}') \
--output=jsonpath={.items..metadata.name})
@@ -47,7 +47,7 @@ $ kubectl get persistentvolumeclaim {{ .Values.persistentVolumeClaim }}
{{- if .Values.persistence.enabled }}
$ kubectl get persistentvolumeclaim {{ template "mysqldump.fullname" . }}
{{- else }}
$ kubectl logs `kc get pods --selector=job-name=test-mysqldump --output=jsonpath={.items..metadata.name}`
$ kubectl logs `kubectl get pods --selector=job-name=test-mysqldump --output=jsonpath={.items..metadata.name}`
{{- end -}}
{{- end }}
@@ -103,6 +103,12 @@ data:
exit 1
fi
{{ if .Values.additionalSteps }}
{{- range .Values.additionalSteps }}
{{ . }}
{{- end }}
{{- end }}
{{ if .Values.debug }}
ls -alh ${BACKUP_DIR}
{{ end }}
+8
View File
@@ -40,6 +40,14 @@ debug: false
successfulJobsHistoryLimit: 5
failedJobsHistoryLimit: 5
# additional steps for mysqldump shell script
# will be inserted after all backup and upload jobs completed successfully.
# Use "${BACKUP_DIR}/${TIMESTAMP}_${MYSQL_DB}.sql.gz" as dump file name.
# see examples
additionalSteps: []
# - gsutil cp "${BACKUP_DIR}/${TIMESTAMP}_${MYSQL_DB}.sql.gz" gs://mybucket/latest.sql.gz
# - echo "latest sql dump updated"
## set persistentVolumeClaim to use a PVC that already exists.
## if set will override any settings under `persistence` otherwise
## if not set and `persistence.enabled` set to true, will create a PVC.