Merge "Fix MariaDB backup cronjob"

This commit is contained in:
Zuul 2020-07-31 18:41:32 +00:00 committed by Gerrit Code Review
commit a57fde9051
3 changed files with 15 additions and 16 deletions

View File

@ -100,6 +100,7 @@ get_rows() {
if [[ -e $TMP_DIR/$SQL_FILE ]]; then if [[ -e $TMP_DIR/$SQL_FILE ]]; then
current_db_desc ${DATABASE} ${TMP_DIR}/${SQL_FILE} \ current_db_desc ${DATABASE} ${TMP_DIR}/${SQL_FILE} \
| grep "INSERT INTO \`${TABLE}\` VALUES" > $ROW_FILE | grep "INSERT INTO \`${TABLE}\` VALUES" > $ROW_FILE
return 0
else else
# Error, cannot report the rows # Error, cannot report the rows
echo "No SQL file found - cannot extract the rows" echo "No SQL file found - cannot extract the rows"

View File

@ -27,15 +27,9 @@ metadata:
labels: labels:
{{ tuple $envAll "mariadb-backup" "backup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ tuple $envAll "mariadb-backup" "backup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec: spec:
{{- if .Values.jobs.backup_mariadb.backoffLimit }} schedule: {{ .Values.jobs.mariadb_backup.cron | quote }}
backoffLimit: {{ .Values.jobs.backup_mariadb.backoffLimit }} successfulJobsHistoryLimit: {{ .Values.jobs.mariadb_backup.history.success }}
{{- end }} failedJobsHistoryLimit: {{ .Values.jobs.mariadb_backup.history.failed }}
{{- 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 }}
concurrencyPolicy: Forbid concurrencyPolicy: Forbid
jobTemplate: jobTemplate:
metadata: metadata:
@ -44,6 +38,12 @@ spec:
annotations: 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 }} {{ 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: 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: template:
metadata: metadata:
labels: labels:

View File

@ -226,10 +226,12 @@ dependencies:
services: services:
- endpoint: error_pages - endpoint: error_pages
service: oslo_db service: oslo_db
backup_mariadb: mariadb_backup:
jobs: jobs:
- mariadb-ks-user - mariadb-ks-user
services: null services:
- endpoint: internal
service: oslo_db
prometheus_create_mysql_user: prometheus_create_mysql_user:
services: services:
- endpoint: internal - endpoint: internal
@ -250,10 +252,6 @@ dependencies:
services: services:
- endpoint: internal - endpoint: internal
service: local_image_registry service: local_image_registry
mariadb_backup:
services:
- endpoint: internal
service: oslo_db
tests: tests:
services: services:
- endpoint: internal - endpoint: internal
@ -278,7 +276,7 @@ jobs:
exporter_create_sql_user: exporter_create_sql_user:
backoffLimit: 87600 backoffLimit: 87600
activeDeadlineSeconds: 3600 activeDeadlineSeconds: 3600
backup_mariadb: mariadb_backup:
# activeDeadlineSeconds == 0 means no deadline # activeDeadlineSeconds == 0 means no deadline
activeDeadlineSeconds: 0 activeDeadlineSeconds: 0
backoffLimit: 6 backoffLimit: 6