Skip to content

Commit d540bc2

Browse files
committed
WIP: add CronJob to run Managers data sync job
1 parent 957b9fb commit d540bc2

File tree

7 files changed

+125
-3
lines changed

7 files changed

+125
-3
lines changed

charts/thub/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type: application
66
# This is the chart version. This version number should be incremented each time you make changes
77
# to the chart and its templates, including the app version.
88
# Versions are expected to follow Semantic Versioning (https://semver.org/)
9-
version: 1.10.11
9+
version: 1.11.0
1010

1111
# This is the version number of the application being deployed. This version number should be
1212
# incremented each time you make changes to the application. Versions are not expected to
@@ -23,7 +23,7 @@ dependencies:
2323
- name: keycloak-config
2424
version: 0.1.2
2525
- name: lms-data-service
26-
version: 1.8.3
26+
version: 1.9.0
2727
- name: ojt
2828
version: 1.7.3
2929
- name: user-service

charts/thub/charts/lms-data-service/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type: application
77
# This is the chart version. This version number should be incremented each time you make changes
88
# to the chart and its templates, including the app version.
99
# Versions are expected to follow Semantic Versioning (https://semver.org/)
10-
version: 1.8.3
10+
version: 1.9.0
1111

1212
# This is the version number of the application being deployed. This version number should be
1313
# incremented each time you make changes to the application. Versions are not expected to

charts/thub/charts/lms-data-service/templates/_helpers.tpl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,28 @@ Create the name of the JSON file used by the learners-scheduler-job
215215
{{- end }}
216216
{{- end }}
217217

218+
{{/*
219+
Create the name of the CronJob managers-scheduler-job
220+
*/}}
221+
{{- define "lms-data-service.managersSchedulerJobName" -}}
222+
{{ include "lms-data-service.name" . }}-managers-scheduler-job
223+
{{- end }}
224+
225+
{{/*
226+
Create the name of the JSON file used by the managers-scheduler-job
227+
*/}}
228+
{{- define "lms-data-service.managersSchedulerJobInputFile" -}}
229+
{{- if .Values.managersSchedulerJob.jsonInputFile -}}
230+
{{ print .Values.managersSchedulerJob.jsonInputFile }}
231+
{{- else if eq .Values.global.lmsType "WORKDAY" -}}
232+
{{ print "./temp/start-managers-web-job.json" }}
233+
{{- else -}}
234+
# The Managers data sync job should only be used by WORKDAY environments.
235+
# TODO: make sure a helpful error message is shown if we try to run the mangers scheduler job with SF LMS environment.
236+
{{ print "./temp/start-managers-job.json" }}
237+
{{- end }}
238+
{{- end }}
239+
218240
{{/*
219241
Create the name of the JSON file used by the learning-history-upload-job
220242
*/}}

charts/thub/charts/lms-data-service/templates/event-scheduler-job-input-files-configmap.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ data:
7474
"instruction": "START",
7575
"communicationType": "WEBSERVICE"
7676
}
77+
start-managers-web-job.json: |
78+
{
79+
"type": "MANAGERS",
80+
"instruction": "START",
81+
"communicationType": "WEBSERVICE"
82+
}
7783
start-rosters-web-job.json: |
7884
{
7985
"type": "ROSTERS",
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{{- if .Values.managersSchedulerJob.enabled -}}
2+
apiVersion: batch/v1
3+
kind: CronJob
4+
metadata:
5+
name: {{ include "lms-data-service.managersSchedulerJobName" . }}
6+
# These labels do not also get added to the pods created by this job
7+
labels:
8+
{{- include "lms-data-service.labels" . | nindent 4 }}
9+
jobCommonName: lms-managers-scheduler-job
10+
annotations:
11+
description: >
12+
Sends a message to the LMS Data Service application via ActiveMQ notifying it to
13+
load managers from the LMS.
14+
spec:
15+
schedule: {{ .Values.managersSchedulerJob.schedule | quote }}
16+
concurrencyPolicy: {{ .Values.managersSchedulerJob.concurrencyPolicy | quote }}
17+
jobTemplate:
18+
spec:
19+
template:
20+
metadata:
21+
annotations:
22+
{{- with .Values.managersSchedulerJob.podAnnotations }}
23+
{{- toYaml . | nindent 12 }}
24+
{{- end }}
25+
labels:
26+
{{- with .Values.managersSchedulerJob.podLabels }}
27+
{{- toYaml . | nindent 12 }}
28+
{{- end }}
29+
spec:
30+
containers:
31+
- name: thub-event-scheduler-job
32+
image: "{{ .Values.managersSchedulerJob.image.repository }}:{{ .Values.managersSchedulerJob.image.tag | default (include "thub.eventSchedulerJobTag" .) }}"
33+
imagePullPolicy: {{ .Values.managersSchedulerJob.image.pullPolicy }}
34+
command: ["java", "-jar", "/home/app/application.jar", "jms", "{{ include "lms-data-service.managersSchedulerJobInputFile" . }}"]
35+
ports:
36+
- containerPort: {{ .Values.managersSchedulerJob.port }}
37+
name: http-server
38+
resources:
39+
{{- toYaml .Values.global.eventSchedulerResources | nindent 14 }}
40+
env:
41+
- name: server.port
42+
value: {{ .Values.managersSchedulerJob.port | quote }}
43+
- name: hclabs.scheduler.destinationQueue
44+
value: {{ include "thub.sfLmsDataJobQueueName" . }}
45+
- name: micronaut.jms.activemq.classic.connection-string
46+
valueFrom:
47+
configMapKeyRef:
48+
name: mq-broker-config
49+
key: spring.activemq.brokerUrl
50+
- name: micronaut.jms.activemq.classic.username
51+
valueFrom:
52+
configMapKeyRef:
53+
name: mq-broker-config
54+
key: spring.activemq.user
55+
- name: micronaut.jms.activemq.classic.password
56+
valueFrom:
57+
configMapKeyRef:
58+
name: mq-broker-config
59+
key: spring.activemq.password
60+
volumeMounts:
61+
- name: message-file
62+
mountPath: /home/app/temp
63+
readOnly: true
64+
volumes:
65+
- name: message-file
66+
configMap:
67+
# Provide the name of the ConfigMap containing the files you want
68+
# to add to the container
69+
name: {{ include "lms-data-service.eventSchedulerInputFilesConfigmapName" . }}
70+
restartPolicy: {{ .Values.managersSchedulerJob.restartPolicy }}
71+
{{- end }}

charts/thub/charts/lms-data-service/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,25 @@ learningHistoryUploadJob:
259259
podAnnotations: {}
260260
podLabels: {}
261261

262+
managersSchedulerJob:
263+
# TODO: ideally this would default to true if LMS is Workday.
264+
# {{- if eq .Values.global.lmsType "WORKDAY" -}}
265+
enabled: false
266+
# Run on the eighteenth minute of every 5th hour
267+
schedule: "18 */5 * * *"
268+
concurrencyPolicy: "Replace"
269+
# Overrides the default JSON file used by the job
270+
jsonInputFile: ""
271+
image:
272+
repository: 342628741687.dkr.ecr.us-west-2.amazonaws.com/thub-event-scheduler-cli-job
273+
pullPolicy: IfNotPresent
274+
# Overrides the image tag whose default is the helper "thub.eventSchedulerJobTag".
275+
tag: ""
276+
port: 8099
277+
restartPolicy: Never
278+
podAnnotations: {}
279+
podLabels: {}
280+
262281
rostersSchedulerJob:
263282
enabled: false
264283
# Run on the 27th minute of every hour from 14 thru 23 and 5

charts/thub/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ lms-data-service:
239239
enabled: true
240240
# Run every 33 minutes
241241
schedule: "*/33 * * * *"
242+
managersSchedulerJob:
243+
# TODO: ideally this would default to true if LMS is Workday.
244+
# {{- if eq .Values.global.lmsType "WORKDAY" -}}
245+
enabled: false
242246

243247
ojt:
244248
resources: {}

0 commit comments

Comments
 (0)