Skip to content

Commit

Permalink
Merge branch 'main' into task/process-snow/3254
Browse files Browse the repository at this point in the history
  • Loading branch information
dgboss authored Jan 24, 2024
2 parents d35255e + 9bb7487 commit 7a46ae7
Show file tree
Hide file tree
Showing 26 changed files with 319 additions and 144 deletions.
21 changes: 1 addition & 20 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,7 @@ jobs:
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
EPHEMERAL_STORAGE=True bash openshift/scripts/oc_provision_db.sh ${SUFFIX} apply
prepare-dev-database-backups:
name: Prepare Dev Database Backups
needs: [prepare-dev-database]
runs-on: ubuntu-22.04
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Postgres Backup Cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
bash openshift/scripts/oc_provision_backup_s3_postgres_cronjob.sh ${SUFFIX} apply
EPHEMERAL_STORAGE=True BUCKET=gpdqha DATA_SIZE=1Gi WAL_SIZE=1Gi bash openshift/scripts/oc_provision_crunchy.sh ${SUFFIX} apply
build-web-image:
# Declared ahead of build-api-image ; it runs slightly slower than the api build, and putting
Expand Down
11 changes: 6 additions & 5 deletions api/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from app.percentile import get_precalculated_percentiles
from app.auth import authentication_required, audit
from app import config
from app import health
# from app import health
from app import hourlies
from app.rocketchat_notifications import send_rocketchat_notification
from app.routers import (fba, forecasts, weather_models, c_haines, stations, hfi_calc,
Expand Down Expand Up @@ -123,10 +123,11 @@ async def get_health():
""" A simple endpoint for Openshift Healthchecks.
It's assumed that if patroni is ok, then all is well. """
try:
health_check = health.patroni_cluster_health_check()
# TODO reenable
# health_check = health.patroni_cluster_health_check()

logger.debug('/health - healthy: %s. %s',
health_check.get('healthy'), health_check.get('message'))
# logger.debug('/health - healthy: %s. %s',
# health_check.get('healthy'), health_check.get('message'))

# Instantiate the CFFDRS singleton. Binding to R can take quite some time...
cffdrs_start = perf_counter()
Expand All @@ -137,7 +138,7 @@ async def get_health():
if delta > 0.1:
logger.info('%f seconds added by CFFDRS startup', delta)

return health_check
return {"message": "API healthy", "healthy": True}
except Exception as exception:
logger.error(exception, exc_info=True)
raise
Expand Down
80 changes: 41 additions & 39 deletions api/app/tests/test_health.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
""" Test the health endpoint
"""
import os
import json
import requests
from starlette.testclient import TestClient
import app.main
from app.tests.common import MockResponse


def test_ready_ok():
""" Test health endpoint, given that everything is fine """
client = TestClient(app.main.app)
response = client.get('/api/ready/')
assert response.status_code == 200


def test_health_ok():
""" Test health endpoint, given that everything is fine """
client = TestClient(app.main.app)
response = client.get('/api/health/')
assert response.json().get('healthy')


def test_health_fail(monkeypatch):
""" Test the health endpoint, given that pods aren't up """

def mock_requests_fail_condition(*args, **kwargs):
""" Mock request response """
fixture_path = ('fixtures/console.pathfinder.gov.bc.ca:8443/apis/'
'apps/v1beta1/namespaces/project_namespace/'
'statefulsets/some_suffix_fail.json')
fixture_path = os.path.join(os.path.dirname(__file__), fixture_path)
with open(fixture_path, 'r', encoding="utf-8") as fixture_file:
return MockResponse(json=json.load(fixture_file))

monkeypatch.setattr(requests, 'get', mock_requests_fail_condition)

client = TestClient(app.main.app)
response = client.get('/api/health/')
assert not response.json().get('healthy')
# import os
# import json
# import requests
# from starlette.testclient import TestClient
# import app.main
# from app.tests.common import MockResponse

# TODO reenable

#
# def test_ready_ok():
# """ Test health endpoint, given that everything is fine """
# client = TestClient(app.main.app)
# response = client.get('/api/ready/')
# assert response.status_code == 200


# def test_health_ok():
# """ Test health endpoint, given that everything is fine """
# client = TestClient(app.main.app)
# response = client.get('/api/health/')
# assert response.json().get('healthy')


# def test_health_fail(monkeypatch):
# """ Test the health endpoint, given that pods aren't up """

# def mock_requests_fail_condition(*args, **kwargs):
# """ Mock request response """
# fixture_path = ('fixtures/console.pathfinder.gov.bc.ca:8443/apis/'
# 'apps/v1beta1/namespaces/project_namespace/'
# 'statefulsets/some_suffix_fail.json')
# fixture_path = os.path.join(os.path.dirname(__file__), fixture_path)
# with open(fixture_path, 'r', encoding="utf-8") as fixture_file:
# return MockResponse(json=json.load(fixture_file))

# monkeypatch.setattr(requests, 'get', mock_requests_fail_condition)

# client = TestClient(app.main.app)
# response = client.get('/api/health/')
# assert not response.json().get('healthy')
7 changes: 4 additions & 3 deletions openshift/scripts/oc_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ OBJ_NAME="${APP_NAME}-${SUFFIX}"
OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${PATH_DC} \
-p SUFFIX=${SUFFIX} \
-p PROJECT_NAMESPACE=${PROJ_TARGET} \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_READ_HOST=${POSTGRES_READ_HOST:-"patroni-${APP_NAME}-${SUFFIX}-replica"} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
-p VANITY_DOMAIN=${VANITY_DOMAIN} \
${SECOND_LEVEL_DOMAIN:+ "-p SECOND_LEVEL_DOMAIN=${SECOND_LEVEL_DOMAIN}"} \
${GUNICORN_WORKERS:+ "-p GUNICORN_WORKERS=${GUNICORN_WORKERS}"} \
Expand Down
1 change: 1 addition & 0 deletions openshift/scripts/oc_deploy_to_production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ MODULE_NAME=web bash $(dirname ${0})/oc_promote.sh ${SUFFIX} ${RUN_TYPE}
# Using pmtiles now, TODO: remove once pmtiles is satisfactory in prod over sometime
# MODULE_NAME=tileserv bash $(dirname ${0})/oc_promote.sh ${SUFFIX} ${RUN_TYPE}
echo Provision database
PROJ_TARGET=${PROJ_TARGET} BUCKET=lwzrin DATA_SIZE=45Gi WAL_SIZE=15Gi bash $(dirname ${0})/oc_provision_crunchy.sh prod ${RUN_TYPE}
CPU_REQUEST=75m CPU_LIMIT=2000m MEMORY_REQUEST=2Gi MEMORY_LIMIT=16Gi PVC_SIZE=45Gi PROJ_TARGET=${PROJ_TARGET} bash $(dirname ${0})/oc_provision_db.sh prod ${RUN_TYPE}
# Using pmtiles now, TODO: remove once pmtiles is satisfactory in prod over sometime
# echo Provision tileserv
Expand Down
9 changes: 5 additions & 4 deletions openshift/scripts/oc_provision_c_haines_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/c_haines.cronjob.ya
-p IMAGE_NAME=${APP_NAME}-api-${SUFFIX} \
-p IMAGE_TAG=${SUFFIX} \
-p SUFFIX=${SUFFIX} \
-p POSTGRES_USER=wps \
-p POSTGRES_DATABASE=wps \
-p POSTGRES_WRITE_HOST=patroni-wps-${SUFFIX}-leader \
-p POSTGRES_READ_HOST=patroni-wps-${SUFFIX}-replica \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"}"

# Apply template (apply or use --dry-run)
Expand Down
73 changes: 73 additions & 0 deletions openshift/scripts/oc_provision_crunchy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/sh -l
#
source "$(dirname ${0})/common/common"

#%
#% OpenShift Deploy Helper
#%
#% Intended for use with a pull request-based pipeline.
#% Suffixes incl.: pr-###.
#%
#% Usage:
#%
#% ${THIS_FILE} [SUFFIX] [apply]
#%
#% Examples:
#%
#% Provide a PR number. Defaults to a dry-run.
#% ${THIS_FILE} pr-0
#%
#% Apply when satisfied.
#% ${THIS_FILE} pr-0 apply
#%


# Target project override for Dev or Prod deployments
#
PROJ_TARGET="${PROJ_TARGET:-${PROJ_DEV}}"

# Prepare names for crunchy ephemeral instance for this PR.
IMAGE_STREAM_NAMESPACE=${IMAGE_STREAM_NAMESPACE:-${PROJ_TOOLS}}
EPHEMERAL_STORAGE=${EPHEMERAL_STORAGE:-'False'}

# Process template
OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/crunchy.yaml \
-p NAME=\"crunchy-${APP_NAME}-${SUFFIX}\" \
-p SUFFIX=\"${SUFFIX}\" \
-p TARGET_NAMESPACE=${PROJ_TARGET} \
${BUCKET:+ " -p BUCKET=${BUCKET}"} \
${DATA_SIZE:+ " -p DATA_SIZE=${DATA_SIZE}"} \
${WAL_SIZE:+ " -p WAL_SIZE=${WAL_SIZE}"} \
${IMAGE_NAME:+ " -p IMAGE_NAME=${IMAGE_NAME}"} \
${IMAGE_TAG:+ " -p IMAGE_TAG=${IMAGE_TAG}"} \
${IMAGE_REGISTRY:+ " -p IMAGE_REGISTRY=${IMAGE_REGISTRY}"} \
${PVC_SIZE:+ " -p PVC_SIZE=${PVC_SIZE}"} \
${CPU_REQUEST:+ "-p CPU_REQUEST=${CPU_REQUEST}"} \
${CPU_LIMIT:+ "-p CPU_LIMIT=${CPU_LIMIT}"} \
${MEMORY_REQUEST:+ "-p MEMORY_REQUEST=${MEMORY_REQUEST}"} \
${MEMORY_LIMIT:+ "-p MEMORY_LIMIT=${MEMORY_LIMIT}"}"


# In order to avoid running out of storage quota in our development environment, use
# ephemeral storage by removing the pvc request from the template.
if [ "$EPHEMERAL_STORAGE" = "True" ]
then
# Pipe the template to jq, and delete the pvc and volume claim items from the template.
OC_PROCESS="${OC_PROCESS} | jq 'del(.items[2].spec.template.spec.volumes[0].persistentVolumeClaim) \
| del(.items[2].spec.volumeClaimTemplates)'"
fi

# Apply template (apply or use --dry-run)
#
OC_APPLY="oc -n ${PROJ_TARGET} apply -f -"
[ "${APPLY}" ] || OC_APPLY="${OC_APPLY} --dry-run=client"

# Execute commands
#

eval "${OC_PROCESS}"
eval "${OC_PROCESS} | ${OC_APPLY}"

# Provide oc command instruction
#
display_helper "${OC_PROCESS} | ${OC_APPLY}"
7 changes: 4 additions & 3 deletions openshift/scripts/oc_provision_ec_gdps_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/env_canada_gdps.cro
-p NAME=${APP_NAME} \
-p SUFFIX=${SUFFIX} \
-p SCHEDULE=\"${SCHEDULE}\" \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_READ_HOST=${POSTGRES_READ_HOST:-"patroni-${APP_NAME}-${SUFFIX}-replica"} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"} \
${IMAGE_REGISTRY:+ "-p IMAGE_REGISTRY=${IMAGE_REGISTRY}"}"

Expand Down
7 changes: 4 additions & 3 deletions openshift/scripts/oc_provision_ec_hrdps_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/env_canada_hrdps.cr
-p NAME=${APP_NAME} \
-p SUFFIX=${SUFFIX} \
-p SCHEDULE=\"${SCHEDULE}\" \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_READ_HOST=${POSTGRES_READ_HOST:-"patroni-${APP_NAME}-${SUFFIX}-replica"} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"} \
${IMAGE_REGISTRY:+ "-p IMAGE_REGISTRY=${IMAGE_REGISTRY}"}"

Expand Down
7 changes: 4 additions & 3 deletions openshift/scripts/oc_provision_ec_rdps_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/env_canada_rdps.cro
-p NAME=${APP_NAME} \
-p SUFFIX=${SUFFIX} \
-p SCHEDULE=\"${SCHEDULE}\" \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_READ_HOST=${POSTGRES_READ_HOST:-"patroni-${APP_NAME}-${SUFFIX}-replica"} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"} \
${IMAGE_REGISTRY:+ "-p IMAGE_REGISTRY=${IMAGE_REGISTRY}"}"

Expand Down
7 changes: 4 additions & 3 deletions openshift/scripts/oc_provision_noaa_gfs_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/noaa_gfs.cronjob.ya
-p NAME=${APP_NAME} \
-p SUFFIX=${SUFFIX} \
-p SCHEDULE=\"${SCHEDULE}\" \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_READ_HOST=${POSTGRES_READ_HOST:-"patroni-${APP_NAME}-${SUFFIX}-replica"} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"} \
${IMAGE_REGISTRY:+ "-p IMAGE_REGISTRY=${IMAGE_REGISTRY}"}"

Expand Down
7 changes: 4 additions & 3 deletions openshift/scripts/oc_provision_noaa_nam_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/noaa_nam.cronjob.ya
-p NAME=${APP_NAME} \
-p SUFFIX=${SUFFIX} \
-p SCHEDULE=\"${SCHEDULE}\" \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_READ_HOST=${POSTGRES_READ_HOST:-"patroni-${APP_NAME}-${SUFFIX}-replica"} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"} \
${IMAGE_REGISTRY:+ "-p IMAGE_REGISTRY=${IMAGE_REGISTRY}"}"

Expand Down
7 changes: 4 additions & 3 deletions openshift/scripts/oc_provision_viirs_snow_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/viirs_snow.cronjob.
-p NAME=${APP_NAME} \
-p SUFFIX=${SUFFIX} \
-p SCHEDULE=\"${SCHEDULE}\" \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_READ_HOST=${POSTGRES_READ_HOST:-"patroni-${APP_NAME}-${SUFFIX}-replica"} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"} \
${IMAGE_REGISTRY:+ "-p IMAGE_REGISTRY=${IMAGE_REGISTRY}"}"

Expand Down
6 changes: 4 additions & 2 deletions openshift/scripts/oc_provision_wfwx_hourly_actuals_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/wfwx_hourly_actuals
-p APP_LABEL=${APP_NAME}-${SUFFIX} \
-p SUFFIX=${SUFFIX} \
-p SCHEDULE=\"${SCHEDULE}\" \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"} \
${IMAGE_REGISTRY:+ "-p IMAGE_REGISTRY=${IMAGE_REGISTRY}"}"

Expand Down
6 changes: 4 additions & 2 deletions openshift/scripts/oc_provision_wfwx_noon_forecasts_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ OC_PROCESS="oc -n ${PROJ_TARGET} process -f ${TEMPLATE_PATH}/wfwx_noon_forecasts
-p APP_LABEL=${APP_NAME}-${SUFFIX} \
-p SUFFIX=${SUFFIX} \
-p SCHEDULE=\"${SCHEDULE}\" \
-p POSTGRES_USER=${POSTGRES_USER:-${APP_NAME}} \
-p POSTGRES_DATABASE=${POSTGRES_DATABASE:-${APP_NAME}} \
-p POSTGRES_WRITE_HOST=${POSTGRES_WRITE_HOST:-"patroni-${APP_NAME}-${SUFFIX}-leader"} \
-p POSTGRES_USER=wps-crunchydb-${SUFFIX} \
-p POSTGRES_WRITE_HOST=wps-crunchydb-${SUFFIX}-primary \
-p POSTGRES_READ_HOST=wps-crunchydb-${SUFFIX}-primary \
-p CRUNCHYDB_USER=wps-crunchydb-${SUFFIX}-pguser-wps-crunchydb-${SUFFIX} \
${PROJ_TOOLS:+ "-p PROJ_TOOLS=${PROJ_TOOLS}"} \
${IMAGE_REGISTRY:+ "-p IMAGE_REGISTRY=${IMAGE_REGISTRY}"}"

Expand Down
6 changes: 4 additions & 2 deletions openshift/templates/c_haines.cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ parameters:
required: true
- name: POSTGRES_DATABASE
required: true
- name: CRUNCHYDB_USER
required: true
- name: APP_LABEL
required: true
objects:
Expand Down Expand Up @@ -82,8 +84,8 @@ objects:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: ${GLOBAL_NAME}
key: app-db-password
name: ${CRUNCHYDB_USER}
key: password
- name: POSTGRES_WRITE_HOST
value: ${POSTGRES_WRITE_HOST}
- name: POSTGRES_READ_HOST
Expand Down
Loading

0 comments on commit 7a46ae7

Please sign in to comment.