Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replicas #52

Merged
merged 11 commits into from
Apr 2, 2024
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#
# Build
#
FROM maven:3.9.5-amazoncorretto-17-al2023@sha256:eeaa7ab572d931f7273fc5cf31429923f172091ae388969e11f42ec6dd817d74 as buildtime
FROM maven:3.9.6-amazoncorretto-17-al2023@sha256:4c8bd9ec72b372f587f7b9d92564a307e4f5180b7ec08455fb346617bae1757e as buildtime
WORKDIR /build
COPY . .
RUN --mount=type=secret,id=GH_TOKEN,dst=/tmp/secret_token export GITHUB_TOKEN_READ_PACKAGES="$(cat /tmp/secret_token)" \
&& mvn clean package -Dmaven.test.skip=true

FROM amazoncorretto:17.0.9-alpine3.18@sha256:df48bf2e183230040890460ddb4359a10aa6c7aad24bd88899482c52053c7e17 as builder
FROM amazoncorretto:17.0.10-alpine3.19@sha256:180e9c91bdbaad3599fedd2f492bf0d0335a9382835aa64669b2c2a8de7c9a22 as builder
COPY --from=buildtime /build/target/*.jar application.jar
RUN java -Djarmode=layertools -jar application.jar extract


FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v1.1.0@sha256:6fa320d452fa22066441f1ef292d15eb06f944bc8bca293e1a91ea460d30a613
ADD --chown=spring:spring https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.25.1/opentelemetry-javaagent.jar .
FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v1.1.3@sha256:a4e970ef05ecf2081424a64707e7c20856bbc40ddb3e99b32a24cd74591817c4
#ADD --chown=spring:spring https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.25.1/opentelemetry-javaagent.jar .

COPY --chown=spring:spring --from=builder dependencies/ ./
COPY --chown=spring:spring --from=builder snapshot-dependencies/ ./
Expand All @@ -24,4 +24,5 @@ COPY --chown=spring:spring --from=builder application/ ./

EXPOSE 8080

ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar","--enable-preview","org.springframework.boot.loader.JarLauncher"]
#ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar","--enable-preview","org.springframework.boot.loader.JarLauncher"]
ENTRYPOINT ["java","--enable-preview","org.springframework.boot.loader.JarLauncher"]
14 changes: 12 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ apiVersion: v2
name: pagopa-api-cache-chart
description: Microservice that handles calculation for pagoPA Advanced Fees Management
type: application
version: 0.50.0
version: 0.53.0
dependencies:
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: postgresql
condition: postgresql.enabled
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: postgresql-replica
condition: postgresql.enabled
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
Expand All @@ -29,6 +34,11 @@ dependencies:
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-p
condition: postgresql.enabled
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-p-replica
condition: postgresql.enabled
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
Expand All @@ -44,4 +54,4 @@ dependencies:
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-oprod
condition: oracleprod.enabled
appVersion: 0.8.19
appVersion: 0.8.19-3-replicas
69 changes: 68 additions & 1 deletion helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ microservice-chart: &microservice-chart
namespace: "apiconfig"
image:
repository: ghcr.io/pagopa/pagopa-api-config-cache
tag: 0.8.19
tag: 0.8.19-3-replicas
canaryDelivery:
deployment:
image:
Expand Down Expand Up @@ -83,6 +83,26 @@ postgresql:
envSecrets:
!!merge <<: *envSecret
DB_CONFIG_PASSWORD: "postgresql-db-cfg-password"
postgresql-replica:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
path: /api-config-cache/pr(/|$)(.*)
envConfig:
!!merge <<: *envConfig
APPLICATIONINSIGHTS_ROLE_NAME: "pagopa-api-config-cache-postgresql-replica"
DB_CONFIG_URL: "jdbc:postgresql://ndp.d.db-nodo-pagamenti.com:6432/nodo-replica?sslmode=require&prepareThreshold=0&currentSchema=cfg"
DB_CONFIG_USER: "cfg"
DB_CONFIG_DRIVER: "org.postgresql.Driver"
DATABASE_ID: "pr"
HEALTHCHECK_QUERY: "select 1"
SAVE_DB: "false"
SEND_EVENT: "false"
secretProvider:
!!merge <<: *azureSecretProvider
envSecrets:
!!merge <<: *envSecret
DB_CONFIG_PASSWORD: "postgresql-db-cfg-password"
oracle:
!!merge <<: *microservice-chart
ingress:
Expand Down Expand Up @@ -145,6 +165,7 @@ refresh-p:
namespace: "apiconfig"
schedule: "0 0 * * *"
timeZone: "Europe/Rome"
successfulJobsHistoryLimit: "1"
image:
repository: "curlimages/curl"
tag: "latest"
Expand Down Expand Up @@ -183,10 +204,54 @@ refresh-p:
operator: In
values:
- user
refresh-p-replica:
namespace: "apiconfig"
schedule: "0 0 * * *"
timeZone: "Europe/Rome"
successfulJobsHistoryLimit: "1"
image:
repository: "curlimages/curl"
tag: "latest"
pullPolicy: "Always"
command:
- "curl"
- "-k"
- "-m"
- "\"300\""
- "--header"
- "\"Ocp-Apim-Subscription-Key: $(API_CONFIG_CACHE_SUBSCRIPTION_KEY)\""
- "https://api.dev.platform.pagopa.it/api-config-cache/pr/v1/cache/refresh"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "150m"
secretProvider:
!!merge <<: *azureSecretProvider
envSecrets:
!!merge <<: *envSecret
API_CONFIG_CACHE_SUBSCRIPTION_KEY: "cfg-for-node-subscription-key"
tolerations:
- key: dedicated
operator: Equal
value: "apiconfig"
effect: NoSchedule
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node_type
operator: In
values:
- user
refresh-o:
namespace: "apiconfig"
schedule: "0 0 * * *"
timeZone: "Europe/Rome"
successfulJobsHistoryLimit: "1"
image:
repository: "curlimages/curl"
tag: "latest"
Expand Down Expand Up @@ -229,6 +294,7 @@ refresh-odev:
namespace: "apiconfig"
schedule: "0 0 * * *"
timeZone: "Europe/Rome"
successfulJobsHistoryLimit: "1"
image:
repository: "curlimages/curl"
tag: "latest"
Expand Down Expand Up @@ -271,6 +337,7 @@ refresh-oprod:
namespace: "apiconfig"
schedule: "0 0 * * *"
timeZone: "Europe/Rome"
successfulJobsHistoryLimit: "1"
image:
repository: "curlimages/curl"
tag: "latest"
Expand Down
73 changes: 72 additions & 1 deletion helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ microservice-chart: &microservice-chart
namespace: "apiconfig"
image:
repository: ghcr.io/pagopa/pagopa-api-config-cache
tag: 0.8.19
tag: 0.8.19-3-replicas
canaryDelivery:
deployment:
image:
Expand Down Expand Up @@ -92,6 +92,26 @@ postgresql:
envSecrets:
!!merge <<: *envSecret
DB_CONFIG_PASSWORD: "postgresql-db-cfg-password"
postgresql-replica:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
path: /api-config-cache/p(/|$)(.*)
envConfig:
!!merge <<: *envConfig
APPLICATIONINSIGHTS_ROLE_NAME: "pagopa-api-config-cache-postgresql-replica"
DB_CONFIG_URL: "jdbc:postgresql://nodo-db.p.internal.postgresql.pagopa.it:6432/nodo-replica?sslmode=require&prepareThreshold=0&currentSchema=cfg"
DB_CONFIG_USER: "cfg"
DB_CONFIG_DRIVER: "org.postgresql.Driver"
DATABASE_ID: "pr"
HEALTHCHECK_QUERY: "select 1"
SAVE_DB: "false"
SEND_EVENT: "false"
secretProvider:
!!merge <<: *azureSecretProvider
envSecrets:
!!merge <<: *envSecret
DB_CONFIG_PASSWORD: "postgresql-db-cfg-password"
oracle:
!!merge <<: *microservice-chart
ingress:
Expand Down Expand Up @@ -191,6 +211,57 @@ refresh-p:
app.kubernetes.io/instance: "cache"
namespaces: ["apiconfig"]
topologyKey: topology.kubernetes.io/zone
refresh-p-replica:
namespace: "apiconfig"
schedule: "0 0 * * *"
timeZone: "Europe/Rome"
image:
repository: "curlimages/curl"
tag: "latest"
pullPolicy: "Always"
command:
- "curl"
- "-k"
- "-m"
- "\"300\""
- "--header"
- "\"Ocp-Apim-Subscription-Key: $(API_CONFIG_CACHE_SUBSCRIPTION_KEY)\""
- "https://api.platform.pagopa.it/api-config-cache/pr/v1/cache/refresh"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "150m"
secretProvider:
!!merge <<: *azureSecretProvider
envSecrets:
!!merge <<: *envSecret
API_CONFIG_CACHE_SUBSCRIPTION_KEY: "cfg-for-node-subscription-key"
tolerations:
- key: dedicated
operator: Equal
value: "apiconfig"
effect: NoSchedule
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node_type
operator: In
values:
- user
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/instance: "cache"
namespaces: ["apiconfig"]
topologyKey: topology.kubernetes.io/zone
refresh-o:
namespace: "apiconfig"
schedule: "0 0 * * *"
Expand Down
64 changes: 63 additions & 1 deletion helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ microservice-chart: &microservice-chart
namespace: "apiconfig"
image:
repository: ghcr.io/pagopa/pagopa-api-config-cache
tag: 0.8.19
tag: 0.8.19-3-replicas
canaryDelivery:
deployment:
image:
Expand Down Expand Up @@ -83,6 +83,26 @@ postgresql:
envSecrets:
!!merge <<: *envSecret
DB_CONFIG_PASSWORD: "postgresql-db-cfg-password"
postgresql-replica:
!!merge <<: *microservice-chart
ingress:
!!merge <<: *ingress
path: /api-config-cache/p(/|$)(.*)
envConfig:
!!merge <<: *envConfig
APPLICATIONINSIGHTS_ROLE_NAME: "pagopa-api-config-cache-postgresql-replica"
DB_CONFIG_URL: "jdbc:postgresql://nodo-db.u.internal.postgresql.pagopa.it:6432/nodo-replica?sslmode=require&prepareThreshold=0&currentSchema=cfg"
DB_CONFIG_USER: "cfg"
DB_CONFIG_DRIVER: "org.postgresql.Driver"
DATABASE_ID: "pr"
HEALTHCHECK_QUERY: "select 1"
SAVE_DB: "false"
SEND_EVENT: "false"
secretProvider:
!!merge <<: *azureSecretProvider
envSecrets:
!!merge <<: *envSecret
DB_CONFIG_PASSWORD: "postgresql-db-cfg-password"
oracle:
!!merge <<: *microservice-chart
ingress:
Expand Down Expand Up @@ -149,6 +169,48 @@ refresh-p:
operator: In
values:
- user
refresh-p-replica:
namespace: "apiconfig"
schedule: "0 0 * * *"
timeZone: "Europe/Rome"
image:
repository: "curlimages/curl"
tag: "latest"
pullPolicy: "Always"
command:
- "curl"
- "-k"
- "-m"
- "\"300\""
- "--header"
- "\"Ocp-Apim-Subscription-Key: $(API_CONFIG_CACHE_SUBSCRIPTION_KEY)\""
- "https://api.uat.platform.pagopa.it/api-config-cache/pr/v1/cache/refresh"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "150m"
secretProvider:
!!merge <<: *azureSecretProvider
envSecrets:
!!merge <<: *envSecret
API_CONFIG_CACHE_SUBSCRIPTION_KEY: "cfg-for-node-subscription-key"
tolerations:
- key: dedicated
operator: Equal
value: "apiconfig"
effect: NoSchedule
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node_type
operator: In
values:
- user
refresh-o:
namespace: "apiconfig"
schedule: "0 0 * * *"
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "API-Config Cache ${service}",
"description": "Generate cache for various microservices",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.8.19"
"version": "0.8.19-3-replicas"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_export.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "API-Config Cache ${service}",
"description": "Generate cache for various microservices",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.8.19"
"version": "0.8.19-3-replicas"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_fdrv1.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "API-Config Cache ${service}",
"description": "Generate cache for various microservices",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.8.19"
"version": "0.8.19-3-replicas"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_nodev1.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "API-Config Cache ${service}",
"description": "Generate cache for various microservices",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.8.19"
"version": "0.8.19-3-replicas"
},
"servers": [
{
Expand Down
Loading
Loading