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
57 changes: 45 additions & 12 deletions mojaloop/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3391,22 +3391,61 @@ transaction-requests-service:
replicaCount: 1
image:
repository: mojaloop/transaction-requests-service
tag: v9.3.0
tag: v9.4.0
pullPolicy: Always

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 +3457,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 +3481,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 }}
109 changes: 88 additions & 21 deletions transaction-requests-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "transactionrequestsservice.fullname" . }}
name: {{ template "transaction-requests-service.fullname" . }}
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 }}
Expand All @@ -12,35 +12,34 @@ spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "transactionrequestsservice.name" . }}
app.kubernetes.io/name: {{ include "transaction-requests-service.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
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 "+" "_" }}
spec:
{{- if .Values.global.config.affinity }}
{{- if .Values.global.config.affinity }}
affinity:
{{ toYaml .Values.global.config.affinity | indent 8 }}
{{- end }}
{{- if .Values.global.config.nodeSelector }}
{{ toYaml .Values.global.config.affinity | indent 8 }}
{{- end }}
{{- if .Values.global.config.nodeSelector }}
nodeSelector:
{{ toYaml .Values.global.config.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.global.config.tolerations }}
{{ toYaml .Values.global.config.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.global.config.tolerations }}
tolerations:
{{ toYaml .Values.global.config.tolerations | indent 8 }}
{{- end }}
{{- if .Values.init.enabled }}
initContainers: {
}
{{ toYaml .Values.global.config.tolerations | indent 8 }}
{{- end }}
{{- if .Values.init.enabled }}
initContainers: []
{{- end }}
containers:
- name: {{ .Chart.Name }}
- name: {{ template "transaction-requests-service.name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
Expand Down Expand Up @@ -69,13 +68,81 @@ spec:
value: {{ .Values.config.log_level }}
- name: CSL_LOG_TRANSPORT
value: {{ .Values.config.log_transport }}
- name: EVENT_SDK_LOG_FILTER
value: {{ .Values.config.event_log_filter | quote }}
- name: EVENT_SDK_LOG_METADATA_ONLY
value: {{ .Values.config.event_log_metadata_only | quote }}
{{- if .Values.sidecar.enabled }}
- name: EVENT_SDK_SIDECAR_DISABLED
value: "false"
- name: EVENT_SDK_SERVER_HOST
value: {{ .Values.sidecar.config.event_log_grpc_host | quote }}
- name: EVENT_SDK_SERVER_PORT
value: {{ .Values.sidecar.config.event_log_grpc_port | quote }}
{{- end }}
- name: EVENT_SDK_VENDOR_PREFIX
value: {{ .Values.config.event_trace_vendor | quote }}
- name: EVENT_SDK_TRACESTATE_HEADER_ENABLED
value: {{ .Values.config.event_trace_state_enabled | quote }}
- name: EVENT_SDK_ASYNC_OVERRIDE_EVENTS
value: {{ .Values.config.event_async_override | quote }}
- name: EVENT_SDK_TRACEID_PER_VENDOR
value: {{ .Values.config.event_traceid_per_vendor | quote }}
volumeMounts:
- name: {{ template "transactionrequestsservice.fullname" . }}-config-volume
- name: {{ template "transaction-requests-service.fullname" . }}-config-volume
mountPath: /opt/transaction-requests-service/config
{{- if .Values.sidecar.enabled }}
- name: {{ .Chart.Name }}-sidecar
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
{{- if .Values.sidecar.image.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.sidecar.image.imagePullSecrets | indent 10 }}
{{- end }}
command: {{ .Values.sidecar.image.command }}
ports:
- containerPort: {{ .Values.sidecar.service.internalPort }}
{{- if .Values.sidecar.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.sidecar.readinessProbe.httpGet.path }}
port: {{ .Values.sidecar.service.internalPort }}
initialDelaySeconds: {{ .Values.sidecar.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.sidecar.readinessProbe.periodSeconds }}
{{- end }}
{{- if .Values.sidecar.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.sidecar.livenessProbe.httpGet.path }}
port: {{ .Values.sidecar.service.internalPort }}
initialDelaySeconds: {{ .Values.sidecar.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.sidecar.livenessProbe.periodSeconds }}
{{- end }}
volumeMounts:
- name: {{ template "transaction-requests-service.fullname" . }}-sidecar-volume
mountPath: /opt/event-sidecar/config
env:
- name: LOG_LEVEL
value: {{ .Values.sidecar.config.log_level | quote }}
- name: LOG_FILTER
value: {{ .Values.sidecar.config.log_filter | quote }}
- name: EVENT_SDK_LOG_FILTER
value: {{ .Values.sidecar.config.event_log_filter | quote }}
- name: EVENT_SDK_LOG_METADATA_ONLY
value: {{ .Values.sidecar.config.event_log_metadata_only | quote }}
{{- end }}
volumes:
- name: {{ template "transactionrequestsservice.fullname" . }}-config-volume
- name: {{ template "transaction-requests-service.fullname" . }}-config-volume
configMap:
name: {{ template "transactionrequestsservice.fullname" . }}-config
name: {{ template "transaction-requests-service.fullname" . }}-config
items:
- key: default.json
path: default.json
path: default.json
{{- if .Values.sidecar.enabled }}
- name: {{ template "transaction-requests-service.fullname" . }}-sidecar-volume
configMap:
name: {{ template "transaction-requests-service.fullname" . }}-sidecar
items:
- key: default.json
path: default.json
{{- end }}
Loading