forked from bcgov/queue-management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrond-send-appointment-reminder-deploy.yaml
317 lines (315 loc) · 10.5 KB
/
crond-send-appointment-reminder-deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
kind: Template
apiVersion: v1
metadata:
annotations:
description: Deployment template for appointment reminder job.
tags: '${NAME}-${TAG_NAME}'
name: '${NAME}-${TAG_NAME}-deploy'
objects:
- kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ${NAME}
labels:
app: ${NAME}
app-group: ${APP_GROUP}
rules:
- apiGroups:
- ''
resources:
- pods
verbs:
- get
- kind: ServiceAccount
apiVersion: v1
metadata:
name: ${NAME}
labels:
app: ${NAME}
app-group: ${APP_GROUP}
- kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ${NAME}
labels:
app: ${NAME}
app-group: ${APP_GROUP}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ${NAME}
subjects:
- kind: ServiceAccount
name: ${NAME}
- kind: ConfigMap
apiVersion: v1
metadata:
name: '${NAME}-${TAG_NAME}-cron-configuration'
labels:
app: 'send-appointment-reminder-crond-${TAG_NAME}'
app-group: '${APP_GROUP}'
template: '${NAME}-cron-configuration'
data:
crontab: '${CRONTAB}'
- kind: ConfigMap
apiVersion: v1
metadata:
name: '${NAMECONFIG}-${TAG_NAME}-config'
labels:
app: '${NAMECONFIG}-${TAG_NAME}'
app-group: '${APP_GROUP}'
template: '${NAMECONFIG}-config'
data:
OIDC_PROVIDER_TOKEN_URL: '${OIDC_PROVIDER_TOKEN_URL}'
REMINDER_ENDPOINT: '${REMINDER_ENDPOINT}'
SERVICE_ACCOUNT_ID: '${SERVICE_ACCOUNT_ID}'
SERVICE_ACCOUNT_SECRET: '${SERVICE_ACCOUNT_SECRET}'
MAIL_FROM_ID: '${MAIL_FROM_ID}'
EMAIL_APPOINTMENT_APP_URL: '${EMAIL_APPOINTMENT_APP_URL}'
MAX_EMAIL_PER_BATCH: '${MAX_EMAIL_PER_BATCH}'
NOTIFICATIONS_EMAIL_ENDPOINT: '${NOTIFICATIONS_EMAIL_ENDPOINT}'
NOTIFICATIONS_ENDPOINT: '${NOTIFICATIONS_ENDPOINT}'
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: '${NAME}-${TAG_NAME}'
labels:
app: '${NAME}-${TAG_NAME}'
app-group: '${APP_GROUP}'
template: '${NAME}-deploy'
spec:
strategy:
type: Rolling
rollingParams:
updatePeriodSeconds: 1
intervalSeconds: 1
timeoutSeconds: 600
maxUnavailable: 25%
maxSurge: 25%
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- '${NAME}-${TAG_NAME}'
from:
kind: ImageStreamTag
namespace: '${IMAGE_NAMESPACE}'
name: '${NAME}:${TAG_NAME}'
- type: ConfigChange
replicas: 1
test: false
selector:
app: '${NAME}-${TAG_NAME}'
deploymentconfig: '${NAME}-${TAG_NAME}'
template:
metadata:
labels:
app: '${NAME}-${TAG_NAME}'
app-group: '${APP_GROUP}'
deploymentconfig: '${NAME}-${TAG_NAME}'
template: '${NAME}-deploy'
spec:
serviceAccountName: ${NAME}
volumes:
- name: cron-config
configMap:
name: '${NAME}-${TAG_NAME}-cron-configuration'
defaultMode: 420
containers:
- name: '${NAME}-${TAG_NAME}'
image: >-
docker-registry.default.svc:5000/${IMAGE_NAMESPACE}/${NAME}:${TAG_NAME}
ports:
- containerPort: 8080
protocol: TCP
volumeMounts:
- name: cron-config
readOnly: true
mountPath: /appointment_reminder/cron/
env:
- name: EMAIL_APPOINTMENT_APP_URL
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: EMAIL_APPOINTMENT_APP_URL
- name: MAIL_FROM_ID
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: MAIL_FROM_ID
- name: MAX_EMAIL_PER_BATCH
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: MAX_EMAIL_PER_BATCH
- name: OIDC_PROVIDER_TOKEN_URL
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: OIDC_PROVIDER_TOKEN_URL
- name: REMINDER_ENDPOINT
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: REMINDER_ENDPOINT
- name: SERVICE_ACCOUNT_ID
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: SERVICE_ACCOUNT_ID
- name: SERVICE_ACCOUNT_SECRET
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: SERVICE_ACCOUNT_SECRET
- name: NOTIFICATIONS_EMAIL_ENDPOINT
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: NOTIFICATIONS_EMAIL_ENDPOINT
- name: NOTIFICATIONS_ENDPOINT
valueFrom:
configMapKeyRef:
name: 'appointment-reminder-${TAG_NAME}-config'
key: NOTIFICATIONS_ENDPOINT
resources:
requests:
cpu: '${CPU_REQUEST}'
memory: '${MEMORY_REQUEST}'
limits:
cpu: '${CPU_LIMIT}'
memory: '${MEMORY_LIMIT}'
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
- kind: Service
apiVersion: v1
metadata:
name: '${NAME}-${TAG_NAME}'
creationTimestamp: null
labels:
app: '${NAME}-${TAG_NAME}'
app-group: '${APP_GROUP}'
template: '${NAME}-deploy'
spec:
ports:
- name: 8080-tcp
protocol: TCP
port: 8080
targetPort: 8080
selector:
deploymentconfig: '${NAME}-${TAG_NAME}'
type: ClusterIP
sessionAffinity: None
status:
loadBalancer: {}
parameters:
- name: NAME
displayName: Name
description: >-
The name assigned to all of the OpenShift resources associated to the
server instance.
required: true
value: send-appointment-reminder-crond
- name: APP_GROUP
displayName: App Group
description: The name assigned to all of the deployments in this project.
required: true
value: ''
- name: IMAGE_NAMESPACE
displayName: Image Namespace
required: true
description: >-
The namespace of the OpenShift project containing the imagestream for the
application.
value: df1ee0-tools
- name: TAG_NAME
displayName: Environment TAG name
description: 'The TAG name for this environment, e.g., dev, test, prod'
required: true
value: ''
- name: CPU_REQUEST
displayName: Resources CPU Request
description: The resources CPU request (in cores) for this build.
required: true
value: 100m
- name: CPU_LIMIT
displayName: Resources CPU Limit
description: The resources CPU limit (in cores) for this build.
required: true
value: 100m
- name: MEMORY_REQUEST
displayName: Resources Memory Request
description: 'The resources Memory request (in Mi, Gi, etc) for this build.'
required: true
value: 100Mi
- name: MEMORY_LIMIT
displayName: Resources Memory Limit
description: 'The resources Memory limit (in Mi, Gi, etc) for this build.'
required: true
value: 2Gi
- name: CRONTAB
displayName: Cron configuration
description: Cron configuration for the scheduler.
required: true
value: |
00 23 * * * default cd /appointment_reminder && ./run.sh
# An empty line is required at the end of this file for a valid cron file.
- name: NAMECONFIG
displayName: NAMECONFIG
description: >-
The name assigned to all of the OpenShift resources associated to the
server instance.
required: true
- name: OIDC_PROVIDER_TOKEN_URL
displayName: Oidc token url
description: Keycloak token url
required: true
- name: REMINDER_ENDPOINT
displayName: Reminder endpoint
description: >-
Endpoint to invoke to send reminders. for ex:https://queue-api
url/api/v1/appointment/reminders
required: true
- name: SERVICE_ACCOUNT_ID
displayName: Service account id
description: >-
Service client id in oidc provider to invoke the job. This service account
must have reminder_job role.
required: true
- name: SERVICE_ACCOUNT_SECRET
displayName: Service account secret
description: Service account secret obtained from keycloak.
required: true
- name: MAIL_FROM_ID
description: Mail from address to appear on emails
required: false
- name: EMAIL_APPOINTMENT_APP_URL
description: Appointment Url to provide in citizen reminder email
required: true
- name: MAX_EMAIL_PER_BATCH
description: Maximum emails which can be sent in a minute
required: false
- name: CHES_SSO_TOKEN_URL
description: >-
CHES token url. See https://github.com/bcgov/common-hosted-email-service
for more details.
required: false
- name: CHES_SSO_CLIENT_ID
description: CHES service client id
required: false
- name: CHES_POST_EMAIL_ENDPOINT
description: CHES email send endpoint
required: false
- name: CHES_SSO_CLIENT_SECRET
description: CHES service client secret
required: true
- name: NOTIFICATIONS_ENDPOINT
description: Notifications endpoint
required: false