From fae5dcbb017d91cf0a6a7673e67a3d27a7f35674 Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Mon, 15 Jul 2024 12:26:44 +0800 Subject: [PATCH 1/6] Kustomize: update container names in CronJob resources. --- .../harvest-email-referrals/kustomization.yaml | 10 ++++++++++ .../cronjobs/overdue-task-email/kustomization.yaml | 10 ++++++++++ .../harvest-email-referrals/kustomization.yaml | 10 ++++++++++ .../uat/cronjobs/overdue-task-email/kustomization.yaml | 10 ++++++++++ 4 files changed, 40 insertions(+) diff --git a/kustomize/overlays/prod/cronjobs/harvest-email-referrals/kustomization.yaml b/kustomize/overlays/prod/cronjobs/harvest-email-referrals/kustomization.yaml index ae5fa7c4..878cab56 100644 --- a/kustomize/overlays/prod/cronjobs/harvest-email-referrals/kustomization.yaml +++ b/kustomize/overlays/prod/cronjobs/harvest-email-referrals/kustomization.yaml @@ -5,3 +5,13 @@ resources: nameSuffix: -harvest-email-referrals patches: - path: patch.yaml + # Patch the CronJob container name + - target: + kind: CronJob + name: prs-cronjob + options: + allowNameChange: true + patch: |- + - op: replace + path: /spec/jobTemplate/spec/template/spec/containers/0/name + value: prs-cronjob-harvest-email-referrals diff --git a/kustomize/overlays/prod/cronjobs/overdue-task-email/kustomization.yaml b/kustomize/overlays/prod/cronjobs/overdue-task-email/kustomization.yaml index 1793185c..fc018043 100644 --- a/kustomize/overlays/prod/cronjobs/overdue-task-email/kustomization.yaml +++ b/kustomize/overlays/prod/cronjobs/overdue-task-email/kustomization.yaml @@ -5,3 +5,13 @@ resources: nameSuffix: -overdue-task-email patches: - path: patch.yaml + # Patch the CronJob container name + - target: + kind: CronJob + name: prs-cronjob + options: + allowNameChange: true + patch: |- + - op: replace + path: /spec/jobTemplate/spec/template/spec/containers/0/name + value: prs-cronjob-overdue-task-email diff --git a/kustomize/overlays/uat/cronjobs/harvest-email-referrals/kustomization.yaml b/kustomize/overlays/uat/cronjobs/harvest-email-referrals/kustomization.yaml index ae5fa7c4..878cab56 100644 --- a/kustomize/overlays/uat/cronjobs/harvest-email-referrals/kustomization.yaml +++ b/kustomize/overlays/uat/cronjobs/harvest-email-referrals/kustomization.yaml @@ -5,3 +5,13 @@ resources: nameSuffix: -harvest-email-referrals patches: - path: patch.yaml + # Patch the CronJob container name + - target: + kind: CronJob + name: prs-cronjob + options: + allowNameChange: true + patch: |- + - op: replace + path: /spec/jobTemplate/spec/template/spec/containers/0/name + value: prs-cronjob-harvest-email-referrals diff --git a/kustomize/overlays/uat/cronjobs/overdue-task-email/kustomization.yaml b/kustomize/overlays/uat/cronjobs/overdue-task-email/kustomization.yaml index 1793185c..fc018043 100644 --- a/kustomize/overlays/uat/cronjobs/overdue-task-email/kustomization.yaml +++ b/kustomize/overlays/uat/cronjobs/overdue-task-email/kustomization.yaml @@ -5,3 +5,13 @@ resources: nameSuffix: -overdue-task-email patches: - path: patch.yaml + # Patch the CronJob container name + - target: + kind: CronJob + name: prs-cronjob + options: + allowNameChange: true + patch: |- + - op: replace + path: /spec/jobTemplate/spec/template/spec/containers/0/name + value: prs-cronjob-overdue-task-email From 1e62c3c39fc910646470ee1424c5563ab629a8d7 Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Wed, 17 Jul 2024 15:26:15 +0800 Subject: [PATCH 2/6] Tweak deployment replicas and requests. --- kustomize/base/deployment.yaml | 6 +++--- kustomize/base/deployment_hpa.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kustomize/base/deployment.yaml b/kustomize/base/deployment.yaml index aea72f9e..7f6fc385 100644 --- a/kustomize/base/deployment.yaml +++ b/kustomize/base/deployment.yaml @@ -32,10 +32,10 @@ spec: value: "Australia/Perth" resources: requests: - memory: "128Mi" - cpu: "10m" + memory: "100Mi" + cpu: "5m" limits: - memory: "4096Mi" + memory: "2Gi" cpu: "1000m" startupProbe: httpGet: diff --git a/kustomize/base/deployment_hpa.yaml b/kustomize/base/deployment_hpa.yaml index b9f30375..52bb9d27 100644 --- a/kustomize/base/deployment_hpa.yaml +++ b/kustomize/base/deployment_hpa.yaml @@ -3,8 +3,8 @@ kind: HorizontalPodAutoscaler metadata: name: prs-deployment-hpa spec: - minReplicas: 1 - maxReplicas: 3 + minReplicas: 2 + maxReplicas: 10 scaleTargetRef: apiVersion: apps/v1 kind: Deployment From 5beb0607b0f819352f376c983e05fe0f63940c4e Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Mon, 22 Jul 2024 14:03:51 +0800 Subject: [PATCH 3/6] Allow PRS locations layer name to be specified in settings. --- prs2/context_processors.py | 1 + prs2/referral/static/js/referral_map.js | 5 ++--- prs2/settings.py | 1 + prs2/templates/base_prs.html | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/prs2/context_processors.py b/prs2/context_processors.py index d6daa722..37b6050e 100644 --- a/prs2/context_processors.py +++ b/prs2/context_processors.py @@ -9,6 +9,7 @@ def template_context(request): 'site_acronym': settings.APPLICATION_ACRONYM, 'version_no': settings.APPLICATION_VERSION_NO, 'prs_geoserver_url': settings.PRS_GEOSERVER_URL, + 'prs_layer_name': settings.PRS_LAYER_NAME, 'mapproxy_url': settings.MAPPROXY_URL, 'geocoder_url': settings.GEOCODER_URL, 'geoserver_url': settings.GEOSERVER_URL, diff --git a/prs2/referral/static/js/referral_map.js b/prs2/referral/static/js/referral_map.js index 3fe150ee..d54ce639 100644 --- a/prs2/referral/static/js/referral_map.js +++ b/prs2/referral/static/js/referral_map.js @@ -1,6 +1,5 @@ "use strict"; -// NOTE: some global variables are set in the base template. - +// NOTE: some global constants are set in the base template. // Define baselayer tile layers. const landgateOrthomosaic = L.tileLayer.wms(mapproxy_url, { layers: 'virtual-mosaic', @@ -31,7 +30,7 @@ const cadastre = L.tileLayer.wms(mapproxy_url, { minZoom: 13, }); const prsLocations = L.tileLayer.wms(prs_geoserver_url, { - layers: 'prs:prs_locations_view', + layers: prs_layer_name, format: 'image/png', transparent: true, opacity: 0.75, diff --git a/prs2/settings.py b/prs2/settings.py index 8681934f..15d6f1e2 100644 --- a/prs2/settings.py +++ b/prs2/settings.py @@ -48,6 +48,7 @@ # PRS may deploy its own instance of Geoserver. PRS_GEOSERVER_URL = env('PRS_GEOSERVER_URL', '') +PRS_LAYER_NAME = env('PRS_LAYER_NAME', '') MAPPROXY_URL = env('MAPPROXY_URL', '') GEOCODER_URL = env('GEOCODER_URL', '') GEOSERVER_URL = env('GEOSERVER_URL', '') diff --git a/prs2/templates/base_prs.html b/prs2/templates/base_prs.html index a29c0b23..c5ace5f2 100644 --- a/prs2/templates/base_prs.html +++ b/prs2/templates/base_prs.html @@ -170,6 +170,7 @@