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

#828: Integrate Sidecar for Transaction Request Service #288

Merged
merged 13 commits into from
Mar 23, 2020
1 change: 1 addition & 0 deletions finance-portal-settlement-management/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1
description: Portal Settlement
name: finance-portal-settlement-management
version: 9.2.0
Expand Down
58 changes: 46 additions & 12 deletions mojaloop/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3391,22 +3391,62 @@ transaction-requests-service:
replicaCount: 1
image:
repository: mojaloop/transaction-requests-service
tag: v9.3.0
tag: v9.4.0
pullPolicy: Always
command: '["node", "src/index.js", "api"]'

readinessProbe:
enabled: false
enabled: true
httpGet:
path: /health
initialDelaySeconds: 60
periodSeconds: 15

livenessProbe:
enabled: false
enabled: true
httpGet:
path: /health
initialDelaySeconds: 60
periodSeconds: 15

sidecar:
enabled: true
image:
repository: mojaloop/event-sidecar
tag: v9.3.0
pullPolicy: Always
command: '["npm", "run", "start"]'
service:
internalPort: 4001
readinessProbe:
enabled: true
httpGet:
path: /health
initialDelaySeconds: 120
periodSeconds: 15
livenessProbe:
enabled: true
httpGet:
path: /health
initialDelaySeconds: 90
periodSeconds: 15
config:
event_log_grpc_host: localhost
event_log_grpc_port: 50051
event_log_filter: 'audit:*, log:info, log:warn, log:error'
event_log_metadata_only: true
log_level: info
log_filter: 'error, warn, info'

config:
central_services_host: '$release_name-centralledger-service'
central_services_port: 80
log_level: info
log_transport: file

error_handling:
include_cause_extension: false
truncate_extensions: true

## metric configuration for prometheus instrumentation
metrics:
Expand All @@ -3418,22 +3458,16 @@ transaction-requests-service:
defaultLabels:
serviceName: transaction-requests

config:
central_services_host: '$release_name-centralledger-service'
central_services_port: 80
log_level: info
log_transport: file

init:
enabled: false
enabled: true

service:
type: ClusterIP
ports:
api:
name: http-api
externalPort: 80
internalPort: 4001
internalPort: 4000

annotations: {}

Expand All @@ -3448,7 +3482,7 @@ transaction-requests-service:
ports:
api:
name: http-api
externalPort: 4001
externalPort: 4000

ingress:
enabled: true
Expand Down
50 changes: 50 additions & 0 deletions transaction-requests-service/configs/default-sidecar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- $kafkaHost := ( .Values.config.kafka_host | replace "$release_name" .Release.Name ) -}}
{
"PORT": {{ .Values.sidecar.service.internalPort }},
"EVENT_LOGGER_GRPC_HOST": "{{ .Values.sidecar.config.event_log_grpc_host }}",
"EVENT_LOGGER_GRPC_PORT": {{ .Values.sidecar.config.event_log_grpc_port }},
"INSTRUMENTATION": {
"METRICS": {
"DISABLED": false,
"labels": {
"eventId": "*"
},
"config": {
"timeout": 5000,
"prefix": "moja_",
"defaultLabels": {
"serviceName": "{{ template "transaction-requests-service.name" . }}-event-sidecar"
}
}
}
},
"KAFKA": {
"TOPIC_TEMPLATES": {
"GENERAL_TOPIC_TEMPLATE": {
"TEMPLATE": "topic-{{"{{"}}functionality{{"}}"}}",
"REGEX": "topic-(.*)"
}
},
"PRODUCER": {
"EVENT": {
"config": {
"options": {
"messageCharset": "utf8"
},
"rdkafkaConf": {
"metadata.broker.list": "{{ $kafkaHost }}:{{ .Values.config.kafka_port }}",
"client.id": "es-prod-event",
"event_cb": true,
"dr_cb": true,
"socket.keepalive.enable": true,
"queue.buffering.max.messages": 10000000
},
"topicConf": {
"request.required.acks": "all",
"partitioner": "{{ .Values.config.kafka_partitioner }}"
}
}
}
}
}
}
30 changes: 17 additions & 13 deletions transaction-requests-service/configs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@
"generateTimeout": 30000
},
"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}},
"truncateExtensions": {{ .Values.config.error_handling.truncate_extensions }}
},
"INSTRUMENTATION": {
"METRICS": {
"DISABLED": {{ not .Values.metrics.enabled }},
"labels": {
"eventId": "*"
},
"config": {
"timeout": {{ .Values.metrics.config.timeout }},
"prefix": {{ .Values.metrics.config.prefix | quote }},
"defaultLabels": {
{{- range $key, $value := .Values.metrics.config.defaultLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
"METRICS": {
"DISABLED": {{ not .Values.metrics.enabled }},
"labels": {
"eventId": "*"
},
"config": {
"timeout": {{ .Values.metrics.config.timeout }},
"prefix": {{ .Values.metrics.config.prefix | quote }},
"defaultLabels": {
{{- range $key, $value := .Values.metrics.config.defaultLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
}
}
}
}
}
}
4 changes: 2 additions & 2 deletions transaction-requests-service/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "transactionrequestsservice.name" -}}
{{- define "transaction-requests-service.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "transactionrequestsservice.fullname" -}}
{{- define "transaction-requests-service.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
21 changes: 18 additions & 3 deletions transaction-requests-service/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "transactionrequestsservice.fullname" . }}-config
name: {{ template "transaction-requests-service.fullname" . }}-config
labels:
app.kubernetes.io/name: {{ include "transactionrequestsservice.name" . }}
app.kubernetes.io/name: {{ include "transaction-requests-service.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
data:
default.json: {{ (tpl (.Files.Get "configs/default.json") . ) | quote }}
default.json: {{ (tpl (.Files.Get "configs/default.json") . ) | quote }}
{{- if .Values.sidecar.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "transaction-requests-service.fullname" . }}-sidecar
labels:
app.kubernetes.io/name: {{ include "transaction-requests-service.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
data:
default.json: {{ (tpl (.Files.Get "configs/default-sidecar.json") . ) | quote }}
{{- end }}
Loading