From c10de970c3f8a339c39282f5415fc1795f06f3ad Mon Sep 17 00:00:00 2001 From: "Parsons, Cliff (cp769u)" Date: Wed, 29 Jul 2020 20:55:02 +0000 Subject: [PATCH] Fix postgresql backup cronjob deployment issues There are a couple of issues that need fixing: 1) "backoffLimit" and "activeDeadlineSeconds" attributes are placed in the CronJob part of the cron-job-backup-postgres.yaml, but should be placed in the Job template part. 2) The backup cronjob had two names in the values.yaml "backup_postgresql" and "postgresql_backup" in various places. It should be "postgresql_backup" in all of those places so that the CronJob can be deployed correctly. Change-Id: Ifd1c7c03ee947763ac073e55c6d74c211615c343 --- .../templates/cron-job-backup-postgres.yaml | 18 +++++++++--------- postgresql/values.yaml | 11 +++++------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/postgresql/templates/cron-job-backup-postgres.yaml b/postgresql/templates/cron-job-backup-postgres.yaml index b106f7247..98fe9fa8b 100644 --- a/postgresql/templates/cron-job-backup-postgres.yaml +++ b/postgresql/templates/cron-job-backup-postgres.yaml @@ -27,15 +27,9 @@ metadata: labels: {{ tuple $envAll "postgresql-backup" "backup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: -{{- if .Values.jobs.backup_postgresql.backoffLimit }} - backoffLimit: {{ .Values.jobs.backup_postgresql.backoffLimit }} -{{- end }} -{{- if .Values.jobs.backup_postgresql.activeDeadlineSeconds }} - activeDeadlineSeconds: {{ .Values.jobs.backup_postgresql.activeDeadlineSeconds }} -{{- end }} - schedule: {{ .Values.jobs.backup_postgresql.cron | quote }} - successfulJobsHistoryLimit: {{ .Values.jobs.backup_postgresql.history.success }} - failedJobsHistoryLimit: {{ .Values.jobs.backup_postgresql.history.failed }} + schedule: {{ .Values.jobs.postgresql_backup.cron | quote }} + successfulJobsHistoryLimit: {{ .Values.jobs.postgresql_backup.history.success }} + failedJobsHistoryLimit: {{ .Values.jobs.postgresql_backup.history.failed }} concurrencyPolicy: Forbid jobTemplate: metadata: @@ -44,6 +38,12 @@ spec: annotations: {{ dict "envAll" $envAll "podName" "postgresql-backup" "containerNames" (list "init" "backup-perms" "postgresql-backup") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} spec: +{{- if .Values.jobs.postgresql_backup.backoffLimit }} + backoffLimit: {{ .Values.jobs.postgresql_backup.backoffLimit }} +{{- end }} +{{- if .Values.jobs.postgresql_backup.activeDeadlineSeconds }} + activeDeadlineSeconds: {{ .Values.jobs.postgresql_backup.activeDeadlineSeconds }} +{{- end }} template: metadata: labels: diff --git a/postgresql/values.yaml b/postgresql/values.yaml index ca189964b..07a659348 100644 --- a/postgresql/values.yaml +++ b/postgresql/values.yaml @@ -197,9 +197,12 @@ dependencies: - endpoint: node service: local_image_registry static: - backup_postgresql: + postgresql_backup: jobs: - postgresql-ks-user + services: + - endpoint: internal + service: postgresql tests: services: - endpoint: internal @@ -218,10 +221,6 @@ dependencies: service: postgresql jobs: - prometheus-postgresql-exporter-create-user - postgresql_backup: - services: - - endpoint: internal - service: postgresql monitoring: prometheus: @@ -236,7 +235,7 @@ volume: size: 5Gi jobs: - backup_postgresql: + postgresql_backup: # activeDeadlineSeconds == 0 means no deadline activeDeadlineSeconds: 0 backoffLimit: 6