-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ALS timeout handler (#648)
* feat: add ALS timeout handler * feat: enable timeout by default * add comments * add missing config * add missing file * add missing defaults * add missing defaults --------- Co-authored-by: Kalin Krustev <[email protected]>
- Loading branch information
1 parent
75fd370
commit f93539d
Showing
20 changed files
with
1,787 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v2 | ||
version: 1.0.0 | ||
appVersion: v15.4.0-snapshot.31 | ||
description: A Helm chart for Kubernetes | ||
name: account-lookup-service-handler-timeout | ||
maintainers: | ||
- name: Steven Oderayi | ||
email: [email protected] | ||
dependencies: | ||
- name: common | ||
repository: "https://mojaloop.github.io/charts/repo" | ||
version: 3.0.0 | ||
tags: | ||
- moja-common |
50 changes: 50 additions & 0 deletions
50
account-lookup-service/chart-handler-timeout/configs/default-sidecar.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "account-lookup-service-handler-timeout.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 }}" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
account-lookup-service/chart-handler-timeout/configs/default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{{- $centralServicesHost := ( .Values.config.central_services_host | replace "$release_name" .Release.Name ) -}} | ||
{ | ||
"HUB_PARTICIPANT": { | ||
"ID": {{ .Values.config.hub_participant.id }}, | ||
"NAME": {{ .Values.config.hub_participant.name | quote }} | ||
}, | ||
"ADMIN_PORT": 4001, | ||
"API_PORT": {{ .Values.service.internalPort }}, | ||
"PROTOCOL_VERSIONS": {{ .Values.config.protocol_versions | toPrettyJson }}, | ||
"DATABASE": { | ||
"DIALECT": "{{ .Values.config.db_driver }}", | ||
"HOST": {{ .Values.config.db_host | quote }}, | ||
"PORT": {{ .Values.config.db_port }}, | ||
"USER": "{{ .Values.config.db_user }}", | ||
"PASSWORD": "{{ .Values.config.db_password }}", | ||
"DATABASE": "{{ .Values.config.db_database }}", | ||
"POOL_MIN_SIZE": {{ .Values.config.db_connection_pool_min }}, | ||
"POOL_MAX_SIZE": {{ .Values.config.db_connection_pool_max }}, | ||
"ACQUIRE_TIMEOUT_MILLIS": {{ .Values.config.db_acquire_timeout_millis }}, | ||
"CREATE_TIMEOUT_MILLIS": {{ .Values.config.db_create_timeout_millis }}, | ||
"DESTROY_TIMEOUT_MILLIS": {{ .Values.config.db_destroy_timeout_millis }}, | ||
"IDLE_TIMEOUT_MILLIS": {{ .Values.config.db_idle_timeout_millis }}, | ||
"REAP_INTERVAL_MILLIS": {{ .Values.config.db_reap_interval_millis }}, | ||
"CREATE_RETRY_INTERVAL_MILLIS": {{ .Values.config.db_create_retry_interval_millis }}, | ||
"DEBUG": {{ .Values.config.db_debug }} | ||
}, | ||
"DISPLAY_ROUTES": {{ .Values.config.display_routes }}, | ||
"RUN_MIGRATIONS": {{ .Values.config.run_migrations }}, | ||
"PARTICIPANT_CACHE_CONFIG": { | ||
"expiresIn": 10, | ||
"generateTimeout": 30000, | ||
"getDecoratedValue": true | ||
}, | ||
"CENTRAL_SHARED_ENDPOINT_CACHE_CONFIG": { | ||
"expiresIn": {{ .Values.config.central_shared_end_point_cache.expiresIn }}, | ||
"generateTimeout": {{ .Values.config.central_shared_end_point_cache.generateTimeout }}, | ||
"getDecoratedValue": {{ .Values.config.central_shared_end_point_cache.getDecoratedValue }} | ||
}, | ||
"CENTRAL_SHARED_PARTICIPANT_CACHE_CONFIG": { | ||
"expiresIn": {{ .Values.config.central_shared_participant_cache.expiresIn }}, | ||
"generateTimeout": {{ .Values.config.central_shared_participant_cache.generateTimeout }}, | ||
"getDecoratedValue": {{ .Values.config.central_shared_participant_cache.getDecoratedValue }} | ||
}, | ||
"GENERAL_CACHE_CONFIG": { | ||
"CACHE_ENABLED": {{ .Values.config.general_cache.enabled }}, | ||
"MAX_BYTE_SIZE": {{ .Values.config.general_cache.maxByteSize }}, | ||
"EXPIRES_IN_MS": {{ .Values.config.general_cache.expiresIn }} | ||
}, | ||
"PROXY_CACHE": {{ .Values.config.proxy_cache | toPrettyJson | nindent 2 }}, | ||
"HANDLERS": {{ .Values.config.handlers | toPrettyJson | nindent 2 }}, | ||
"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": { | ||
"fspId": "*" | ||
}, | ||
"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 }} | ||
} | ||
} | ||
} | ||
}, | ||
"ENDPOINT_SECURITY": { | ||
"JWS": { | ||
"JWS_SIGN": {{ .Values.config.endpointSecurity.jwsSign }}, | ||
"JWS_SIGNING_KEY_PATH": "secrets/jwsSigningKey.key" | ||
} | ||
}, | ||
"API_DOCUMENTATION_ENDPOINTS": true, | ||
"FEATURE_ENABLE_EXTENDED_PARTY_ID_TYPE": {{ .Values.config.featureEnableExtendedPartyIdType }} | ||
} |
18 changes: 18 additions & 0 deletions
18
account-lookup-service/chart-handler-timeout/configs/knexfile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
const migrationsDirectory = '/opt/app/migrations' | ||
const seedsDirectory = '/opt/app/seeds' | ||
const Config = require('/opt/app/src/lib/config') | ||
module.exports = { | ||
client: 'mysql', | ||
version: '5.7', | ||
connection: Config.DATABASE.connection, | ||
pool: Config.DATABASE.pool, | ||
migrations: { | ||
directory: migrationsDirectory, | ||
tableName: 'migration', | ||
}, | ||
seeds: { | ||
directory: seedsDirectory, | ||
loadExtensions: ['.js'] | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
account-lookup-service/chart-handler-timeout/templates/NOTES.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range .Values.ingress.hosts }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "account-lookup-service-handler-timeout.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get svc -w {{ include "account-lookup-service-handler-timeout.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "account-lookup-service-handler-timeout.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "account-lookup-service-handler-timeout.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl port-forward $POD_NAME 8080:80 | ||
{{- end }} |
41 changes: 41 additions & 0 deletions
41
account-lookup-service/chart-handler-timeout/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "account-lookup-service-handler-timeout.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). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "account-lookup-service-handler-timeout.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "account-lookup-service-handler-timeout.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{- define "account-lookup-service-handler-timeout.apiVersion.Deployment" -}} | ||
{{- if .Capabilities.APIVersions.Has "apps/v1/Deployment" -}} | ||
{{- print "apps/v1" -}} | ||
{{- else -}} | ||
{{- print "apps/v1beta2" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
16 changes: 16 additions & 0 deletions
16
account-lookup-service/chart-handler-timeout/templates/config-override.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{- if .Values.configOverride }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "account-lookup-service-handler-timeout.fullname" . }}-config-override | ||
labels: | ||
app.kubernetes.io/name: {{ include "account-lookup-service-handler-timeout.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.Version }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
data: | ||
{{- range $fileName, $fileContents := .Values.configOverride }} | ||
{{ $fileName | replace "/" "-" }}: | {{ $fileContents | toPrettyJson | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
28 changes: 28 additions & 0 deletions
28
account-lookup-service/chart-handler-timeout/templates/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "account-lookup-service-handler-timeout.fullname" . }}-config | ||
labels: | ||
app.kubernetes.io/name: {{ include "account-lookup-service-handler-timeout.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.Version }} | ||
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 }} | ||
knexfile.js: {{ (tpl (.Files.Get "configs/knexfile.js") . ) | quote }} | ||
{{- if .Values.sidecar.enabled }} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "account-lookup-service-handler-timeout.fullname" . }}-sidecar | ||
labels: | ||
app.kubernetes.io/name: {{ include "account-lookup-service-handler-timeout.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.Version }} | ||
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 }} |
Oops, something went wrong.