Skip to content

Commit 0c82959

Browse files
committed
add CronJob to run Managers data sync job
1 parent a8b98fd commit 0c82959

File tree

8 files changed

+202
-3
lines changed

8 files changed

+202
-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.12
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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,25 @@ Create the name of the JSON file used by the learning-history-upload-job
226226
{{- end }}
227227
{{- end }}
228228

229+
{{/*
230+
Create the name of the CronJob managers-scheduler-job
231+
*/}}
232+
{{- define "lms-data-service.managersSchedulerJobName" -}}
233+
{{ include "lms-data-service.name" . }}-managers-scheduler-job
234+
{{- end }}
235+
236+
{{/*
237+
Create the name of the JSON file used by the managers-scheduler-job
238+
*/}}
239+
{{- define "lms-data-service.managersSchedulerJobInputFile" -}}
240+
{{- if .Values.managersSchedulerJob.jsonInputFile -}}
241+
{{ print .Values.managersSchedulerJob.jsonInputFile }}
242+
# The Managers data sync job can only be used by WORKDAY environments currently.
243+
{{- else if eq .Values.global.lmsType "WORKDAY" -}}
244+
{{ print "./temp/start-managers-web-job.json" }}
245+
{{- end }}
246+
{{- end }}
247+
229248
{{/*
230249
Create the name of the CronJob rosters-scheduler-job
231250
*/}}

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

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

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

262+
managersSchedulerJob:
263+
enabled: false
264+
# Run on the eighteenth minute of every 5th hour
265+
schedule: "18 */5 * * *"
266+
concurrencyPolicy: "Replace"
267+
# Overrides the default JSON file used by the job
268+
jsonInputFile: ""
269+
image:
270+
repository: 342628741687.dkr.ecr.us-west-2.amazonaws.com/thub-event-scheduler-cli-job
271+
pullPolicy: IfNotPresent
272+
# Overrides the image tag whose default is the helper "thub.eventSchedulerJobTag".
273+
tag: ""
274+
port: 8099
275+
restartPolicy: Never
276+
podAnnotations: {}
277+
podLabels: {}
278+
262279
rostersSchedulerJob:
263280
enabled: false
264281
# Run on the 27th minute of every hour from 14 thru 23 and 5
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# This file has test values to use when the chart is being linted
2+
# https://github.com/helm/chart-testing/blob/master/doc/ct_lint.md
3+
# The values are as though the chart is being deployed for a Workday integrated system.
4+
5+
lmsType: "WORKDAY"
6+
7+
managersSchedulerJob:
8+
enabled: true
9+
10+
rostersSchedulerJob:
11+
enabled: true
12+
13+
# Now the rest of this file is the same as charts/thub/ci/test-values.yaml
14+
15+
# AWS credentials for S3 access
16+
awsS3keyId: "exampleId"
17+
awsS3secretKey: "verySecretKey"
18+
19+
assigned-item-service:
20+
# The datasource info for connecting the Grails application to the database
21+
dataSource:
22+
username: "test_username"
23+
password: "test_password"
24+
url: "jdbc:mysql://example.us-east-1.rds.amazonaws.com:3306/schema_name"
25+
26+
item-service:
27+
# The datasource info for connecting the Grails application to the database
28+
dataSource:
29+
username: "test_username"
30+
password: "test_password"
31+
url: "jdbc:mysql://example.us-east-1.rds.amazonaws.com:3306/schema_name"
32+
33+
lms-data-service:
34+
# The datasource info for connecting the Grails application to the database
35+
dataSource:
36+
username: "test_username"
37+
password: "test_password"
38+
url: "jdbc:mysql://example.us-east-1.rds.amazonaws.com:3306/schema_name"
39+
# Encryption key for storing sensitive values in the database
40+
encryptionPassword: "test_password"
41+
# Connection info for the SFTP that the LMS interacts with
42+
sftp:
43+
host: "sftp8.sapsf.com"
44+
user: "my_test_user"
45+
password: "test_password"
46+
downloadDirectory: "FEED/DOWNLOAD/ROLLCALL"
47+
uploadDirectory: "FEED/UPLOAD"
48+
49+
ojt:
50+
# The datasource info for connecting the Grails application to the database
51+
dataSource:
52+
username: "test_username"
53+
password: "test_password"
54+
url: "jdbc:mysql://example.us-east-1.rds.amazonaws.com:3306/schema_name"
55+
56+
user-service:
57+
# The datasource info for connecting the Grails application to the database
58+
dataSource:
59+
username: "test_username"
60+
password: "test_password"
61+
url: "jdbc:mysql://example.us-east-1.rds.amazonaws.com:3306/schema_name"
62+
63+
keycloak-config:
64+
# The username for the database that Keycloak connects to
65+
databaseUsername: "example_keycloak_username"
66+
# The password for the database that Keycloak connects to
67+
databasePassword: "example_keycloak_password"
68+
# Keycloak configuration values
69+
realmName: "test-realm"
70+
clientId: "ojt"
71+
clientSecret: "abcdefg"
72+
# Credentials for the admin of the Keycloak server (master realm)
73+
masterAdminUsername: "test-admin"
74+
# checkov:skip=CKV_SECRET_6:This entire file is just test values
75+
masterAdminPassword: "examplePassword"
76+
# Credentials for an admin of this realm
77+
realmAdminUsername: "realm-admin-username"
78+
# checkov:skip=CKV_SECRET_6:This entire file is just test values
79+
realmAdminPassword: "anotherPassword"

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+
enabled: false
244+
rostersSchedulerJob:
245+
enabled: false
242246

243247
ojt:
244248
resources: {}

0 commit comments

Comments
 (0)