Skip to content

Commit

Permalink
feat(mojaloop/#3991): add proxy cache config for quoting service and …
Browse files Browse the repository at this point in the history
…ml-api-adapter (#638)

feat(mojaloop/#3991): add proxy cache config for quoting service and ml-api-adapter (#638)
- Added proxy lib
- Added configuration for proxy
- Added unit and integration tests for proxy related functionalities
  • Loading branch information
oderayi committed Jul 8, 2024
1 parent 5e57808 commit 56265fd
Show file tree
Hide file tree
Showing 15 changed files with 130 additions and 14 deletions.
1 change: 1 addition & 0 deletions account-lookup-service/chart-service/configs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"MAX_BYTE_SIZE": {{ .Values.config.general_cache.maxByteSize }},
"EXPIRES_IN_MS": {{ .Values.config.general_cache.expiresIn }}
},
"PROXY_CACHE": {{ .Values.config.proxy_cache | toPrettyJson }},
"SWITCH_ENDPOINT": "http://{{ (default .Values.config.central_services_host $centralServicesHost) }}:{{ .Values.config.central_services_port }}",
"ERROR_HANDLING": {
"includeCauseExtension": {{ .Values.config.error_handling.include_cause_extension }},
Expand Down
9 changes: 9 additions & 0 deletions account-lookup-service/chart-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ config:
event_trace_state_enabled: true
event_traceid_per_vendor: false

## Proxy cache configuration
proxy_cache:
enabled: false
type: redis
proxy_config:
host: redis
port: 6379
db: 0

## @param initContainers Add additional init containers to the %%MAIN_CONTAINER_NAME%% pod(s)
## ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
## e.g:
Expand Down
9 changes: 9 additions & 0 deletions account-lookup-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ account-lookup-service:
# -----END RSA PRIVATE KEY-----
# Thirdparty API Config
featureEnableExtendedPartyIdType: false

## Proxy cache configuration
proxy_cache:
enabled: false
type: redis
proxy_config:
host: redis
port: 6379
db: 0
## @param initContainers Add additional init containers to the %%MAIN_CONTAINER_NAME%% pod(s)
## ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
## e.g:
Expand Down
14 changes: 13 additions & 1 deletion example-mojaloop-backend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
- dependency
- backend
- kafka
version: 26.8.5
version: 19.0.2
## mysql database
- name: mysql
alias: mysql
Expand Down Expand Up @@ -98,3 +98,15 @@ dependencies:
- redis
- thirdparty
version: 18.12.1
## Redis for Proxy Cache
- name: redis
alias: proxy-cache-redis
condition: proxy-cache-redis.enabled
repository: https://charts.bitnami.com/bitnami
tags:
- mojaloop
- dependency
- backend
- redis
- proxy
version: 18.12.1
30 changes: 30 additions & 0 deletions example-mojaloop-backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -522,3 +522,33 @@ auth-svc-redis:
## @param master.persistence.enabled Enable persistence on Redis® master nodes using Persistent Volume Claims
##
enabled: false

## Reference: https://github.com/bitnami/charts/blob/main/bitnami/redis/values.yaml
proxy-cache-redis:
enabled: true

## @param architecture Redis® architecture. Allowed values: `standalone` or `replication`
##
architecture: standalone

## @param fullnameOverride String to fully override template
##
fullnameOverride: proxy-cache-redis

## Redis® Authentication parameters
## ref: https://github.com/bitnami/containers/tree/main/bitnami/redis#setting-the-server-password-on-first-run
##
auth:
## @param auth.enabled Enable password authentication
##
enabled: false

## @section Persistence parameters
##
master:
## Enable persistence using Persistent Volume Claims
## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
persistence:
## @param master.persistence.enabled Enable persistence on Redis® master nodes using Persistent Volume Claims
##
enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
}
}
},
"PROXY_CACHE": {{ .Values.config.proxy_cache | toPrettyJson }},
"KAFKA": {
"TOPIC_TEMPLATES": {
"GENERAL_TOPIC_TEMPLATE": {
Expand Down
11 changes: 10 additions & 1 deletion ml-api-adapter/chart-handler-notification/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ config:
# If `jwsSigningKeySecret` is not null, then the `jwsSigningKey` value will be ignored.
# Expected properties of `jwsSigningKeySecret` are `name` and `key`.
jwsSigningKeySecret: null
jwsSigningKey: null
jwsSigningKey: null
# To generate this key:
# Private:
# ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
Expand All @@ -232,6 +232,15 @@ config:
include_cause_extension: false
truncate_extensions: true

## Proxy cache configuration
proxy_cache:
enabled: false
type: redis
proxy_config:
host: redis
port: 6379
db: 0

## @param master.podLabels Extra labels for pod(s)
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
##
Expand Down
9 changes: 9 additions & 0 deletions ml-api-adapter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,15 @@ ml-api-adapter-handler-notification:
include_cause_extension: false
truncate_extensions: true

## Proxy cache configuration
proxy_cache:
enabled: false
type: redis
proxy_config:
host: redis
port: 6379
db: 0

service:
type: ClusterIP
externalPort: 80
Expand Down
24 changes: 21 additions & 3 deletions mojaloop/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ CONFIG:
## BATCH_PROCESSING: To enable batch processing set following to true
batch_processing_enabled: &CL_BATCH_PROCESSING_ENABLED false

## PROXY CACHE
proxy_cache: &PROXY_CACHE
enabled: false
type: redis
proxy_config:
host: proxy-cache-redis-master
port: 6379
db: 0

# Default values for central.
# This is a YAML-formatted file.
# Declare global configurations
Expand Down Expand Up @@ -293,6 +302,9 @@ account-lookup-service:
# Thirdparty API Config
featureEnableExtendedPartyIdType: false

## Proxy cache configuration
proxy_cache: *PROXY_CACHE

# @param initContainers Add additional init containers to the %%MAIN_CONTAINER_NAME%% pod(s)
# ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
# e.g:
Expand Down Expand Up @@ -1271,7 +1283,7 @@ quoting-service:
image:
registry: docker.io
repository: mojaloop/quoting-service
tag: v15.8.0-snapshot.24
tag: v15.8.0-snapshot.31

config:
hub_participant: *HUB_PARTICIPANT
Expand Down Expand Up @@ -1372,7 +1384,7 @@ quoting-service:
image:
registry: docker.io
repository: mojaloop/quoting-service
tag: v15.8.0-snapshot.24
tag: v15.8.0-snapshot.31

config:
hub_participant: *HUB_PARTICIPANT
Expand Down Expand Up @@ -1417,6 +1429,9 @@ quoting-service:
kafka_host: *KAFKA_HOST
kafka_port: *KAFKA_PORT

## Proxy cache configuration
proxy_cache: *PROXY_CACHE

error_handling:
include_cause_extension: false
truncate_extensions: true
Expand Down Expand Up @@ -2003,6 +2018,9 @@ ml-api-adapter:
ecaG/Oyo/S+eM8nR7mc=
-----END PRIVATE KEY-----

## Proxy cache configuration
proxy_cache: *PROXY_CACHE

## Error handling Configuration
error_handling:
include_cause_extension: false
Expand Down Expand Up @@ -7665,7 +7683,7 @@ thirdparty:
# - name: LOG_LEVEL
# value: debug
## Svc configs
config:
config:
hub_participant: *HUB_PARTICIPANT

## Svc config files
Expand Down
2 changes: 1 addition & 1 deletion quoting-service/chart-handler/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
description: Quoting-Service Handler Helm chart for Kubernetes
name: quoting-service-handler
version: 15.4.0
appVersion: v15.8.0-snapshot.21
appVersion: v15.8.0-snapshot.31
home: http://mojaloop.io
icon: http://mojaloop.io/images/logo.png
sources:
Expand Down
1 change: 1 addition & 0 deletions quoting-service/chart-handler/configs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"ENUM_DATA_EXPIRES_IN_MS": {{ .Values.config.cache.enum_data_expires_in_ms }},
"PARTICIPANT_DATA_EXPIRES_IN_MS": {{ .Values.config.cache.participant_data_expires_in_ms }}
},
"PROXY_CACHE": {{ .Values.config.proxy_cache | toPrettyJson }},
"KAFKA": {
"CONSUMER":{
"QUOTE":{
Expand Down
14 changes: 11 additions & 3 deletions quoting-service/chart-handler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ global: {}
image:
registry: docker.io
repository: mojaloop/quoting-service
tag: v15.8.0-snapshot.21
tag: v15.8.0-snapshot.31
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
Expand Down Expand Up @@ -126,7 +126,6 @@ config:
hub_participant:
id: 1
name: Hub

# Protocol versions used for validating (VALIDATELIST) incoming FSPIOP API Headers (Content-type, Accept),
# and for generating requests/callbacks from the Switch itself (DEFAULT value)
protocol_versions: |-
Expand Down Expand Up @@ -199,7 +198,7 @@ config:

endpointSecurity:
jwsSign: false
jwsSigningKey: null
jwsSigningKey: null
# To generate this key:
# Private:
# ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
Expand All @@ -223,6 +222,15 @@ config:
# Not specifying or setting to 0 will default the cache to 60 seconds
participant_data_expires_in_ms: 10

## Proxy cache configuration
proxy_cache:
enabled: false
type: redis
proxy_config:
host: redis
port: 6379
db: 0

rules: []

## @param initContainers Add additional init containers to the %%MAIN_CONTAINER_NAME%% pod(s)
Expand Down
2 changes: 1 addition & 1 deletion quoting-service/chart-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
description: Quoting-Service API Helm chart for Kubernetes
name: quoting-service
version: 15.4.0
appVersion: v15.8.0-snapshot.21
appVersion: v15.8.0-snapshot.31
home: http://mojaloop.io
icon: http://mojaloop.io/images/logo.png
sources:
Expand Down
2 changes: 1 addition & 1 deletion quoting-service/chart-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ global: {}
image:
registry: docker.io
repository: mojaloop/quoting-service
tag: v15.8.0-snapshot.21
tag: v15.8.0-snapshot.31
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
Expand Down
15 changes: 12 additions & 3 deletions quoting-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ quoting-service: # API
image:
registry: docker.io
repository: mojaloop/quoting-service
tag: v15.8.0-snapshot.21
tag: v15.8.0-snapshot.31
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
Expand Down Expand Up @@ -137,7 +137,7 @@ quoting-service: # API
defaultLabels:
serviceName: quoting-service

config:
config:
hub_participant:
id: 1
name: Hub
Expand Down Expand Up @@ -381,7 +381,7 @@ quoting-service-handler:
image:
registry: docker.io
repository: mojaloop/quoting-service
tag: v15.8.0-snapshot.21
tag: v15.8.0-snapshot.31
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
Expand Down Expand Up @@ -568,6 +568,15 @@ quoting-service-handler:
kafka_host: kafka
kafka_port: 9092

## Proxy cache configuration
proxy_cache:
enabled: false
type: redis
proxy_config:
host: redis
port: 6379
db: 0

## Tracing Configuration
event_trace_vendor: mojaloop
event_log_filter: 'audit:*, log:warn, log:error'
Expand Down

0 comments on commit 56265fd

Please sign in to comment.