Fix MariaDB backup cronjob
There are two issues fixed here: 1) The "backoffLimit" and "activeDeadlineSeconds" are attributes of Job, not CronJob. Therefore, they should be placed in the Job template part of the cron-job-backup-mariadb.yaml 2) The backup cronjob had two names in the values.yaml "backup_mariadb" and "mariadb_backup" in various places. 3) When empty table is used, the get_rows function of restore_mariadb.sh exit with a code of 1, which causes the invoking function to error out. Change-Id: Ifa85b97f56e74f7994a2bde2e12c64fb0c9acafb
This commit is contained in:
parent
3978c6a33c
commit
f57aad9822
@ -100,6 +100,7 @@ get_rows() {
|
||||
if [[ -e $TMP_DIR/$SQL_FILE ]]; then
|
||||
current_db_desc ${DATABASE} ${TMP_DIR}/${SQL_FILE} \
|
||||
| grep "INSERT INTO \`${TABLE}\` VALUES" > $ROW_FILE
|
||||
return 0
|
||||
else
|
||||
# Error, cannot report the rows
|
||||
echo "No SQL file found - cannot extract the rows"
|
||||
|
@ -27,15 +27,9 @@ metadata:
|
||||
labels:
|
||||
{{ tuple $envAll "mariadb-backup" "backup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
spec:
|
||||
{{- if .Values.jobs.backup_mariadb.backoffLimit }}
|
||||
backoffLimit: {{ .Values.jobs.backup_mariadb.backoffLimit }}
|
||||
{{- end }}
|
||||
{{- if .Values.jobs.backup_mariadb.activeDeadlineSeconds }}
|
||||
activeDeadlineSeconds: {{ .Values.jobs.backup_mariadb.activeDeadlineSeconds }}
|
||||
{{- end }}
|
||||
schedule: {{ .Values.jobs.backup_mariadb.cron | quote }}
|
||||
successfulJobsHistoryLimit: {{ .Values.jobs.backup_mariadb.history.success }}
|
||||
failedJobsHistoryLimit: {{ .Values.jobs.backup_mariadb.history.failed }}
|
||||
schedule: {{ .Values.jobs.mariadb_backup.cron | quote }}
|
||||
successfulJobsHistoryLimit: {{ .Values.jobs.mariadb_backup.history.success }}
|
||||
failedJobsHistoryLimit: {{ .Values.jobs.mariadb_backup.history.failed }}
|
||||
concurrencyPolicy: Forbid
|
||||
jobTemplate:
|
||||
metadata:
|
||||
@ -44,6 +38,12 @@ spec:
|
||||
annotations:
|
||||
{{ dict "envAll" $envAll "podName" "mariadb-backup" "containerNames" (list "init" "backup-perms" "mariadb-backup") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
|
||||
spec:
|
||||
{{- if .Values.jobs.mariadb_backup.backoffLimit }}
|
||||
backoffLimit: {{ .Values.jobs.mariadb_backup.backoffLimit }}
|
||||
{{- end }}
|
||||
{{- if .Values.jobs.mariadb_backup.activeDeadlineSeconds }}
|
||||
activeDeadlineSeconds: {{ .Values.jobs.mariadb_backup.activeDeadlineSeconds }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
|
@ -226,10 +226,12 @@ dependencies:
|
||||
services:
|
||||
- endpoint: error_pages
|
||||
service: oslo_db
|
||||
backup_mariadb:
|
||||
mariadb_backup:
|
||||
jobs:
|
||||
- mariadb-ks-user
|
||||
services: null
|
||||
services:
|
||||
- endpoint: internal
|
||||
service: oslo_db
|
||||
prometheus_create_mysql_user:
|
||||
services:
|
||||
- endpoint: internal
|
||||
@ -250,10 +252,6 @@ dependencies:
|
||||
services:
|
||||
- endpoint: internal
|
||||
service: local_image_registry
|
||||
mariadb_backup:
|
||||
services:
|
||||
- endpoint: internal
|
||||
service: oslo_db
|
||||
tests:
|
||||
services:
|
||||
- endpoint: internal
|
||||
@ -278,7 +276,7 @@ jobs:
|
||||
exporter_create_sql_user:
|
||||
backoffLimit: 87600
|
||||
activeDeadlineSeconds: 3600
|
||||
backup_mariadb:
|
||||
mariadb_backup:
|
||||
# activeDeadlineSeconds == 0 means no deadline
|
||||
activeDeadlineSeconds: 0
|
||||
backoffLimit: 6
|
||||
|
Loading…
Reference in New Issue
Block a user