-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
249 additions
and
23 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
infrastructure/cron-jobs/populate-transaction-log-temp.cron.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
apiVersion: template.openshift.io/v1 | ||
kind: Template | ||
metadata: | ||
annotations: | ||
description: Template for job that activates api to populate pharmanet transaction log temp | ||
tags: cronjob | ||
name: populate-transaction-log-temp-cronjob-template | ||
objects: | ||
- apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: '${CRON_NAME}' | ||
spec: | ||
concurrencyPolicy: Forbid | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- command: | ||
- bash | ||
- '-c' | ||
- >- | ||
echo -e "-------- STARTING CRON --------\n" | ||
echo -e "-------- Getting access_token --------\n" | ||
TOKEN=$(curl -X POST | ||
"${KEYCLOAK_URL}/realms/${KEYCLOAK_REALM}/protocol/openid-connect/token" | ||
\ | ||
-H "Content-Type: application/x-www-form-urlencoded" \ | ||
-d "grant_type=client_credentials" \ | ||
-d "client_id=${KEYCLOAK_CLIENT_ID}" \ | ||
-d "client_secret=${KEYCLOAK_CLIENT_SECRET}" | jq -r '.access_token') | ||
echo -e ${TOKEN} | ||
echo -e "-------- Calling PRIME API --------\n" | ||
curl -v -X POST | ||
http://${ENV_NAME}-webapi:8080/api/jobs/populate/transaction-log-temp?numberOfDays=15 | ||
\ | ||
-H "Authorization: Bearer ${TOKEN}" \ | ||
-H "Content-Length: 0" | ||
echo -e "-------- CRON COMPLETE --------\n" | ||
env: | ||
- name: KEYCLOAK_CLIENT_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
key: prime_service_account_client_secret | ||
name: prime-service-account | ||
- name: KEYCLOAK_CLIENT_ID | ||
valueFrom: | ||
secretKeyRef: | ||
key: prime_service_account_client_id | ||
name: prime-service-account | ||
- name: KEYCLOAK_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: keycloak | ||
key: KEYCLOAK_URL | ||
- name: KEYCLOAK_REALM | ||
valueFrom: | ||
configMapKeyRef: | ||
name: keycloak | ||
key: KEYCLOAK_REALM | ||
image: >- | ||
public.ecr.aws/h0h9t7p1/alpine-bash-curl-jq:latest | ||
limits: | ||
cpu: 500m | ||
memory: 2Gi | ||
name: '${CRON_NAME}' | ||
requests: | ||
cpu: 100m | ||
memory: 512Mi | ||
resources: null | ||
restartPolicy: Never | ||
schedule: '${CRON_SCHEDULE}' | ||
parameters: | ||
- description: 'Cron-like schedule expression. Default: Once a day at 4 AM' | ||
name: CRON_SCHEDULE | ||
value: '0 10 * * *' | ||
- name: CRON_NAME | ||
value: prod-populate-transaction-log-temp-cronjob | ||
- description: 'Environment name' | ||
name: ENV_NAME | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.