Skip to content

Commit

Permalink
INTLY-1100 Add monitoring label and concurrency policy
Browse files Browse the repository at this point in the history
Allow the concurrency policy to be overridden and default the value
to Forbid. The reasoning for this is to prevent multiple occurrences
of the same Job to run at the same time.

Add monitoring labels to the CronJob and the Jobs that it creates
so that monitoring alerts can reference that when referring to
all Integreatly CronJobs instead of just having a static list.

Verification:
- Modify the cron schedule in the CronJob template to be something
like `*/1 * * * *`, to run once per minute.
- Do an `oc create` on the template.
- Ensure that the created CronJob has the `concurrencyPolicy` of
`Forbid`.
- Ensure that the created CronJob has a label with the name
`monitoring-key` and the value `middleware`.
- Ensure that a Job created by the CronJob has a label with the
name `monitoring-key` and the value `middleware`.
  • Loading branch information
Aiden Keating committed Mar 12, 2019
1 parent f96c935 commit e9398c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions templates/openshift/backup-cronjob-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ objects:
kind: CronJob
metadata:
name: ${NAME}
labels:
monitoring-key: middleware
spec:
schedule: ${CRON_SCHEDULE}
concurrencyPolicy: ${CONCURRENCY_POLICY}
jobTemplate:
spec:
template:
metadata:
name: ${NAME}
labels:
monitoring-key: middleware
cronjob-name: ${NAME}
spec:
serviceAccountName: "${SERVICEACCOUNT}"
Expand Down Expand Up @@ -83,3 +87,6 @@ parameters:
value: backupjob
- name: DEBUG
description: "Debug flag to sleep the job pod after its execution"
- name: CONCURRENCY_POLICY
description: The concurrency policy of the CronJob
value: Forbid
2 changes: 2 additions & 0 deletions templates/openshift/backup-job-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ objects:
kind: Job
metadata:
name: ${NAME}
labels:
monitoring-key: middleware
spec:
parallelism: 1
completions: 1
Expand Down

0 comments on commit e9398c9

Please sign in to comment.