From 34a092a7f4a8bdd089d9e55d02f2259f86ab54dd Mon Sep 17 00:00:00 2001 From: Dmitrii Kabanov Date: Thu, 11 Oct 2018 16:02:02 -0700 Subject: [PATCH] Add startingDeadlineSeconds field to cronJobs This patch set adds "startingDeadlineSeconds" field to cronJobs. When the field is not set, the controller counts how many missed jobs occured from the last scheduled time till now. And if it happends more than 100 time the job will not be scheduled. To avoid this the "startingDeadlineSeconds" field should be set to sufficient period of time. In this case the controller counts how many missed jobs occured during this period of time. The value of the field should be less than time (in seconds) needed for running >100 jobs (according to schedule). Change-Id: I3bf7c7077b55ca5a3421052bd0b59b70c9bbcf24 --- cinder/templates/cron-job-cinder-volume-usage-audit.yaml | 3 +++ cinder/values.yaml | 1 + heat/templates/cron-job-engine-cleaner.yaml | 3 +++ heat/values.yaml | 1 + nova/templates/cron-job-cell-setup.yaml | 3 +++ nova/templates/cron-job-service-cleaner.yaml | 3 +++ nova/values.yaml | 2 ++ 7 files changed, 16 insertions(+) diff --git a/cinder/templates/cron-job-cinder-volume-usage-audit.yaml b/cinder/templates/cron-job-cinder-volume-usage-audit.yaml index e8727147..a15d064f 100644 --- a/cinder/templates/cron-job-cinder-volume-usage-audit.yaml +++ b/cinder/templates/cron-job-cinder-volume-usage-audit.yaml @@ -33,6 +33,9 @@ spec: schedule: {{ .Values.jobs.volume_usage_audit.cron | quote }} successfulJobsHistoryLimit: {{ .Values.jobs.volume_usage_audit.history.success }} failedJobsHistoryLimit: {{ .Values.jobs.volume_usage_audit.history.failed }} + {{- if .Values.jobs.volume_usage_audit.starting_deadline }} + startingDeadlineSeconds: {{ .Values.jobs.volume_usage_audit.starting_deadline }} + {{- end }} concurrencyPolicy: Forbid jobTemplate: metadata: diff --git a/cinder/values.yaml b/cinder/values.yaml index e225130b..368b1610 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -71,6 +71,7 @@ images: jobs: volume_usage_audit: cron: "*/5 * * * *" + starting_deadline: 600 history: success: 3 failed: 1 diff --git a/heat/templates/cron-job-engine-cleaner.yaml b/heat/templates/cron-job-engine-cleaner.yaml index 87b4ba2c..c63159fe 100644 --- a/heat/templates/cron-job-engine-cleaner.yaml +++ b/heat/templates/cron-job-engine-cleaner.yaml @@ -33,6 +33,9 @@ spec: schedule: {{ .Values.jobs.engine_cleaner.cron | quote }} successfulJobsHistoryLimit: {{ .Values.jobs.engine_cleaner.history.success }} failedJobsHistoryLimit: {{ .Values.jobs.engine_cleaner.history.failed }} + {{- if .Values.jobs.engine_cleaner.starting_deadline }} + startingDeadlineSeconds: {{ .Values.jobs.engine_cleaner.starting_deadline }} + {{- end }} concurrencyPolicy: Forbid jobTemplate: metadata: diff --git a/heat/values.yaml b/heat/values.yaml index fd02006b..1cc6858d 100644 --- a/heat/values.yaml +++ b/heat/values.yaml @@ -67,6 +67,7 @@ images: jobs: engine_cleaner: cron: "*/5 * * * *" + starting_deadline: 600 history: success: 3 failed: 1 diff --git a/nova/templates/cron-job-cell-setup.yaml b/nova/templates/cron-job-cell-setup.yaml index 66df4dfa..ee86ca32 100644 --- a/nova/templates/cron-job-cell-setup.yaml +++ b/nova/templates/cron-job-cell-setup.yaml @@ -30,6 +30,9 @@ spec: schedule: {{ .Values.jobs.cell_setup.cron | quote }} successfulJobsHistoryLimit: {{ .Values.jobs.cell_setup.history.success }} failedJobsHistoryLimit: {{ .Values.jobs.cell_setup.history.failed }} + {{- if .Values.jobs.cell_setup.starting_deadline }} + startingDeadlineSeconds: {{ .Values.jobs.cell_setup.starting_deadline }} + {{- end }} concurrencyPolicy: Forbid jobTemplate: metadata: diff --git a/nova/templates/cron-job-service-cleaner.yaml b/nova/templates/cron-job-service-cleaner.yaml index 60f5a984..47fdad96 100644 --- a/nova/templates/cron-job-service-cleaner.yaml +++ b/nova/templates/cron-job-service-cleaner.yaml @@ -30,6 +30,9 @@ spec: schedule: {{ .Values.jobs.service_cleaner.cron | quote }} successfulJobsHistoryLimit: {{ .Values.jobs.service_cleaner.history.success }} failedJobsHistoryLimit: {{ .Values.jobs.service_cleaner.history.failed }} + {{- if .Values.jobs.service_cleaner.starting_deadline }} + startingDeadlineSeconds: {{ .Values.jobs.service_cleaner.starting_deadline }} + {{- end }} concurrencyPolicy: Forbid jobTemplate: metadata: diff --git a/nova/values.yaml b/nova/values.yaml index 6558182a..777469a6 100644 --- a/nova/values.yaml +++ b/nova/values.yaml @@ -100,11 +100,13 @@ jobs: # TODO(portdirect): Add a post-start action to nova compute pods that registers themselves. cell_setup: cron: "0 */1 * * *" + starting_deadline: 600 history: success: 3 failed: 1 service_cleaner: cron: "0 */1 * * *" + starting_deadline: 600 history: success: 3 failed: 1