Skip to content

Commit

Permalink
Added sidecar to experience API (#74)
Browse files Browse the repository at this point in the history
* Added sidecar to experience API

* Bumped up experience svc version

* Bumped up chart versions

* Bumped up version
  • Loading branch information
vijayg10 authored Apr 8, 2022
1 parent f9fbb58 commit 1eec0a5
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 7 deletions.
6 changes: 3 additions & 3 deletions mojaloop/bof/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.3.2
version: 2.4.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2.3.2"
appVersion: "2.4.0"
dependencies:
- name: common
repository: "file://../common"
Expand Down Expand Up @@ -112,4 +112,4 @@ dependencies:
tags:
- mojaloop
- reporting-hub-bop-experience-api-svc
version: 0.0.2
version: 1.0.0
4 changes: 2 additions & 2 deletions mojaloop/reporting-hub-bop-experience-api-svc/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: Experience API for business operations framework
name: reporting-hub-bop-experience-api-svc
version: 0.0.2
appVersion: "0.0.2"
version: 1.0.0
appVersion: "2.0.1"
home: http://mojaloop.io
icon: http://mojaloop.io/images/logo.png
sources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,20 @@ data:
{{ $fileName }}: |
{{- include "common.tplvalues.renderToJson" ( dict "value" $fileContents "context" $ ) | nindent 4 }}
{{- end }}
---
{{- if .Values.sidecar.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}-sidecar
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ template "common.names.name" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
data:
{{- range $fileName, $fileContents := .Values.sidecar.configFiles }}
{{ $fileName }}: |
{{- include "common.tplvalues.render" ( dict "value" $fileContents "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,86 @@ spec:
volumeMounts:
- name: {{ template "common.names.fullname" . }}-config-volume
mountPath: /opt/reporting-hub-bop-experience-api-svc/config
env:
- name: LOG_LEVEL
value: {{ .Values.config.log_level | quote}}
- name: LOG_FILTER
value: {{ .Values.config.log_filter | quote}}
- name: CSL_LOG_TRANSPORT
value: {{ .Values.config.log_transport | quote}}
- 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 }}

{{- 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: {{- include "common.tplvalues.render" (dict "value" .Values.sidecar.image.command "context" $) | nindent 12 }}
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 "common.names.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 "common.names.fullname" . }}-config-volume
configMap:
name: {{ template "common.names.fullname" . }}-config
items:
- key: default.json
path: default.json
{{- if .Values.sidecar.enabled }}
- name: {{ template "common.names.fullname" . }}-sidecar-volume
configMap:
name: {{ template "common.names.fullname" . }}-sidecar
items:
- key: default.json
path: default.json
{{- end }}
109 changes: 107 additions & 2 deletions mojaloop/reporting-hub-bop-experience-api-svc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ global:
storageClass: ""
adminApiSvc: {}
settlementSvc: {}
kafka: {}

podAffinityPreset: ""
## @param podAntiAffinityPreset Pod anti-affinity preset. Ignored if `main.affinity` is set. Allowed values: `soft` or `hard`
Expand Down Expand Up @@ -78,7 +79,7 @@ containerSecurityContext:
image:
registry: docker.io
repository: mojaloop/reporting-hub-bop-experience-api-svc
tag: v0.0.2
tag: v2.0.1
## 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 All @@ -103,6 +104,8 @@ command:
- npm
- start

kafka: {}

## Enable diagnostic mode in the deployment
##
diagnosticMode:
Expand Down Expand Up @@ -183,7 +186,22 @@ metrics:
adminApiSvc: {}
settlementSvc: {}

config: {}
config:
## Log Configuration
log_level: info
log_filter: 'error, warn, info'
log_transport: file

## Tracing Configuration
event_trace_vendor: mojaloop
event_trace_state_enabled: true
event_log_filter: 'audit:*, log:warn, log:error'
# If set to true, only the metadata object from the event will be printed.
event_log_metadata_only: false
# A comma-separated list of events that should return immediately instead of waiting for the event promises to resolve
# Any combination of: `log,audit,trace`
event_async_override: 'log,trace'
event_traceid_per_vendor: false

service:
internalPort: 3001
Expand Down Expand Up @@ -353,3 +371,90 @@ configFiles:
"http://reporting-hub-bop-positions-ui.local"
]
}

sidecar:
enabled: true
image:
repository: mojaloop/event-sidecar
tag: v11.0.1
pullPolicy: IfNotPresent
command:
- npm
- run
- start
service:
name: api
port: 4001
internalPort: 4001
readinessProbe:
enabled: true
httpGet:
path: /health
initialDelaySeconds: 120
periodSeconds: 15
livenessProbe:
enabled: true
httpGet:
path: /health
initialDelaySeconds: 90
periodSeconds: 15
config:
kafka_partitioner: murmur2_random
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'

configFiles:
default.json: |
{
"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 "common.names.name" . }}-event-sidecar"
}
}
}
},
"KAFKA": {
"TOPIC_TEMPLATES": {
"GENERAL_TOPIC_TEMPLATE": {
"TEMPLATE": "topic-{{"{{"}}functionality{{"}}"}}",
"REGEX": "topic-(.*)"
}
},
"PRODUCER": {
"EVENT": {
"config": {
"options": {
"messageCharset": "utf8"
},
"rdkafkaConf": {
"metadata.broker.list": {{ printf "%s:%s" (include "common.backends.centralbroker.host" .) (include "common.backends.centralbroker.port" .) | quote}},
"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.sidecar.config.kafka_partitioner }}"
}
}
}
}
}
}

0 comments on commit 1eec0a5

Please sign in to comment.