Skip to content

Commit

Permalink
[PAGOPA-2113] ci: Add wisp converter cron replica (#131)
Browse files Browse the repository at this point in the history
Co-authored-by: pagopa-github-bot <[email protected]>
  • Loading branch information
cap-ang and pagopa-github-bot authored Oct 11, 2024
1 parent 26984f1 commit db250b1
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 28 deletions.
7 changes: 5 additions & 2 deletions helm/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ dependencies:
- name: microservice-chart
repository: https://pagopa.github.io/aks-microservice-chart-blueprint
version: 3.0.0
digest: sha256:47c6b74ce3ca60c2d4eee8e65c65597e5f62fb420653fcaec310eaa51b472413
generated: "2024-04-09T17:12:54.285532+02:00"
- name: microservice-chart
repository: https://pagopa.github.io/aks-microservice-chart-blueprint
version: 3.0.0
digest: sha256:054952d2271feb275decce7d04d04de803455f4eb23f7654d74225da68424db4
generated: "2024-10-03T10:05:37.640461+02:00"
8 changes: 6 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ apiVersion: v2
name: pagopa-wisp-converter
description: A service that permits to handle nodoInviaRPT and nodoInviaCarrelloRPT request from WISP, interfacing them with GPD system
type: application
version: 0.222.0
appVersion: 0.4.4
version: 0.223.0
appVersion: 0.4.4-1-update-chart-for-cron
dependencies:
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: cron
48 changes: 41 additions & 7 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
microservice-chart:
microservice-chart: &microservice-chart
namespace: "nodo"
nameOverride: ""
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.4"
tag: "0.4.4-1-update-chart-for-cron"
pullPolicy: Always
livenessProbe:
httpGet:
Expand All @@ -27,7 +27,7 @@ microservice-chart:
type: ClusterIP
ports:
- 8080
ingress:
ingress: &ingress
create: true
host: "weudev.nodo.internal.dev.platform.pagopa.it"
path: /pagopa-wisp-converter(/|$)(.*)
Expand All @@ -42,7 +42,7 @@ microservice-chart:
type: RuntimeDefault
securityContext:
allowPrivilegeEscalation: false
resources:
resources: &resources
requests:
memory: "256Mi"
cpu: "0.15"
Expand All @@ -61,7 +61,7 @@ microservice-chart:
# Required
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
envConfig: &envConfig
WEBSITE_SITE_NAME: 'pagopawispconverter' # required to show cloud role name in application insights
ENV: 'aks-dev'
APP_LOGGING_LEVEL: 'DEBUG'
Expand Down Expand Up @@ -100,7 +100,7 @@ microservice-chart:
RT_SEND_SCHEDULING_TIME_IN_MINUTES: '1'
RT_SEND_AVOID_SCHEDULING_ON_STATES: 'PAA_RT_DUPLICATA'
RPT_TIMER_QUEUE_NAME: "nodo_wisp_rpt_timeout_queue"
CRON_JOB_SCHEDULE_RECOVERY_ENABLED: 'true'
CRON_JOB_SCHEDULE_RECOVERY_ENABLED: 'false'
CRON_JOB_SCHEDULE_RECOVERY_RECEIPT_KO_ENABLED: '0 0 * * * *' # top of every hour of every
CRON_JOB_SCHEDULE_RECOVERY_FROM_HOURS_AGO: '2' # from 2 hours ago
CRON_JOB_SCHEDULE_RECOVERY_UNTIL_HOURS_AGO: '1' # until 1 hours ago
Expand All @@ -118,7 +118,7 @@ microservice-chart:
SPRING_PROFILES_ACTIVE: "default,jsonLog"
secretProvider:
create: true
envSecrets:
envSecrets: &envSecret
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'azure-insight-connection-string'
SERVICE_BUS_PAYMENT_TIMEOUT_QUEUE_CONNECTION_STRING: 'wisp-payment-timeout-queue-connection-string'
Expand Down Expand Up @@ -170,3 +170,37 @@ microservice-chart:
pullPolicy: Always
envConfig: {}
envSecret: {}
# 1 - wisp converter service
app:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
resources:
!!merge <<: *resources
envConfig:
!!merge <<: *envConfig
envSecret:
!!merge <<: *envSecret
# 2 - wisp converter cron
cron:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
path: /pagopa-wisp-converter-notused/(.*)
resources:
!!merge <<: *resources
requests:
memory: "256Mi"
cpu: "0.15"
limits:
memory: "768Mi"
cpu: "0.25"
autoscaling:
enable: true
minReplica: 1
maxReplica: 1
envConfig:
!!merge <<: *envConfig
CRON_JOB_SCHEDULE_RECOVERY_ENABLED: 'true'
envSecret:
!!merge <<: *envSecret
46 changes: 40 additions & 6 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
microservice-chart:
microservice-chart: &microservice-chart
namespace: "nodo"
nameOverride: ""
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.4"
tag: "0.4.4-1-update-chart-for-cron"
pullPolicy: Always
livenessProbe:
httpGet:
Expand All @@ -27,7 +27,7 @@ microservice-chart:
type: ClusterIP
ports:
- 8080
ingress:
ingress: &ingress
create: true
host: "weuprod.nodo.internal.platform.pagopa.it"
path: /pagopa-wisp-converter(/|$)(.*)
Expand All @@ -42,7 +42,7 @@ microservice-chart:
type: RuntimeDefault
securityContext:
allowPrivilegeEscalation: false
resources:
resources: &resources
requests:
memory: "640Mi"
cpu: "200m"
Expand Down Expand Up @@ -79,7 +79,7 @@ microservice-chart:
- type: Percent
value: 100
periodSeconds: 20
envConfig:
envConfig: &envConfig
JAVA_OPTS: "-XX:MaxHeapSize=1780m -XX:MinHeapSize=64m"
WEBSITE_SITE_NAME: 'pagopawispconverter' # required to show cloud role name in application insights
ENV: 'aks-prod'
Expand Down Expand Up @@ -137,7 +137,7 @@ microservice-chart:
SPRING_PROFILES_ACTIVE: "default,jsonLog"
secretProvider:
create: true
envSecrets:
envSecrets: &envSecret
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'azure-insight-connection-string'
SERVICE_BUS_PAYMENT_TIMEOUT_QUEUE_CONNECTION_STRING: 'wisp-payment-timeout-queue-connection-string'
Expand Down Expand Up @@ -189,3 +189,37 @@ microservice-chart:
pullPolicy: Always
envConfig: {}
envSecret: {}
# 1 - wisp converter service
app:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
resources:
!!merge <<: *resources
envConfig:
!!merge <<: *envConfig
envSecret:
!!merge <<: *envSecret
# 2 - wisp converter cron
cron:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
path: /pagopa-wisp-converter-notused/(.*)
resources:
!!merge <<: *resources
requests:
memory: "640Mi"
cpu: "0.20"
limits:
memory: "2048Mi"
cpu: "0.50"
autoscaling:
enable: true
minReplica: 1
maxReplica: 1
envConfig:
!!merge <<: *envConfig
CRON_JOB_SCHEDULE_RECOVERY_ENABLED: 'false'
envSecret:
!!merge <<: *envSecret
46 changes: 40 additions & 6 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
microservice-chart:
microservice-chart: &microservice-chart
namespace: "nodo"
nameOverride: ""
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.4"
tag: "0.4.4-1-update-chart-for-cron"
pullPolicy: Always
livenessProbe:
httpGet:
Expand All @@ -27,7 +27,7 @@ microservice-chart:
type: ClusterIP
ports:
- 8080
ingress:
ingress: &ingress
create: true
host: "weuuat.nodo.internal.uat.platform.pagopa.it"
path: /pagopa-wisp-converter(/|$)(.*)
Expand All @@ -42,7 +42,7 @@ microservice-chart:
type: RuntimeDefault
securityContext:
allowPrivilegeEscalation: false
resources:
resources: &resources
requests:
memory: "512Mi"
cpu: "0.25"
Expand All @@ -61,7 +61,7 @@ microservice-chart:
# Required
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
envConfig: &envConfig
WEBSITE_SITE_NAME: 'pagopawispconverter' # required to show cloud role name in application insights
ENV: 'aks-uat'
APP_LOGGING_LEVEL: 'INFO'
Expand Down Expand Up @@ -118,7 +118,7 @@ microservice-chart:
SPRING_PROFILES_ACTIVE: "default,jsonLog"
secretProvider:
create: true
envSecrets:
envSecrets: &envSecret
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'azure-insight-connection-string'
SERVICE_BUS_PAYMENT_TIMEOUT_QUEUE_CONNECTION_STRING: 'wisp-payment-timeout-queue-connection-string'
Expand Down Expand Up @@ -170,3 +170,37 @@ microservice-chart:
pullPolicy: Always
envConfig: {}
envSecret: {}
# 1 - wisp converter service
app:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
resources:
!!merge <<: *resources
envConfig:
!!merge <<: *envConfig
envSecret:
!!merge <<: *envSecret
# 2 - wisp converter cron
cron:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
path: /pagopa-wisp-converter-notused/(.*)
resources:
!!merge <<: *resources
requests:
memory: "256Mi"
cpu: "0.15"
limits:
memory: "768Mi"
cpu: "0.25"
autoscaling:
enable: true
minReplica: 1
maxReplica: 1
envConfig:
!!merge <<: *envConfig
CRON_JOB_SCHEDULE_RECOVERY_ENABLED: 'true'
envSecret:
!!merge <<: *envSecret
2 changes: 1 addition & 1 deletion openapi/openapi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion openapi/openapi_redirect.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.1",
"info": {
"title": "WISP-Converter-redirect",
"version": "0.4.4"
"version": "0.4.4-1-update-chart-for-cron"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>it.gov.pagopa</groupId>
<artifactId>wisp-converter</artifactId>
<version>0.4.4</version>
<version>0.4.4-1-update-chart-for-cron</version>
<name>pagoPA WISP Converter</name>
<description>A service that permits to handle nodoInviaRPT and nodoInviaCarrelloRPT request from WISP, converting them in NMU payments.</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public RecoveryScheduler(RecoveryService recoveryService) {
public void recoverReceiptKOCronJob() {
ZonedDateTime dateFrom = ZonedDateTime.now(ZoneOffset.UTC).minusHours(fromHoursAgo);
ZonedDateTime dateTo = ZonedDateTime.now(ZoneOffset.UTC).minusHours(untilHoursAgo);
log.info("[WISP-Recovery][Scheduled] Reconciliation Cron: recoverReceiptKOCronJob running at {}, for recover stale RPT from {} to {}",
log.info("[WISP-Recovery][Scheduled][Start] Reconciliation Cron: recoverReceiptKOCronJob running at {}, for recover stale RPT from {} to {}",
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()), dateFrom, dateTo);

int missingRTRecovered = this.recoveryService.recoverReceiptKOByDate(dateFrom, dateTo).getPayments().size();
int missingRedirectRecovered = this.recoveryService.recoverMissingRedirect(dateFrom, dateTo);

log.info("[WISP-Recovery][Scheduled] Reconciliation Cron: recoverReceiptKOCronJob {} receipt-ko sent", missingRedirectRecovered + missingRTRecovered);
log.info("[WISP-Recovery][Scheduled][Stop] Reconciliation Cron: recoverReceiptKOCronJob {} receipt-ko sent", missingRedirectRecovered + missingRTRecovered);
this.threadOfExecution = Thread.currentThread();
}
}

0 comments on commit db250b1

Please sign in to comment.