Skip to content

Commit

Permalink
Addition of Financial portal and settlement services (#233)
Browse files Browse the repository at this point in the history
* add finance portal ui chart

* upgrade portal charts

* add db host config to secrets

* Added charts for settlement

* add finance portal proxy and quoting service quotes

* Added command for updating `settlement` chart.

* Added `settlement` to requirements.yaml

* Fixed issues with `settlement` chart.

* add portal stuff

* Used more universal shebang for update script

* Delete this with extreme prejudice (#231)

* Fix deployment probes names

* change settlement ingress ports

* fix finance portal images

* update services version to current version

* fix settlement endpoints

* Update image repository of backend service

* update portal images so the licenses get recognized

* fix centralledger endpoint

* update latest portal versions and fix sql_mode

* fix labels and ingress

* add portal settlement to lint scripts

* change finance-portal-settlement-management name

* Updated selectors for portal and portal settlement management

* Removed duplicate appVersion

Co-authored-by: Vassilis Barzokas <vbarzokas@gmail.com>
Co-authored-by: Matt Kingston <mattkingston@gmail.com>
Co-authored-by: Sam <elnyry@users.noreply.github.com>
Co-authored-by: Miguel de Barros <miguel@debarros.me>
  • Loading branch information
5 people committed Jan 8, 2020
1 parent efc76aa commit 0d2221a
Show file tree
Hide file tree
Showing 24 changed files with 739 additions and 1 deletion.
4 changes: 4 additions & 0 deletions finance-portal-settlement-management/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
description: Portal Settlement
name: finance-portal-settlement-management
version: 8.6.0
appVersion: "8.6.0"
32 changes: 32 additions & 0 deletions finance-portal-settlement-management/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "finance-portal-settlement-management.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 "finance-portal-settlement-management.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 "finance-portal-settlement-management.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
19 changes: 19 additions & 0 deletions finance-portal-settlement-management/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "finance-portal-settlement-management.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.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:
ADMIN_ENDPOINT: {{ (printf "%s%s-%s:%s" "http://" .Release.Name .Values.settlementManagement.config.CENTRAL_LEDGER_SERVICE_NAME .Values.settlementManagement.config.CENTRAL_LEDGER_SERVICE_ADMIN_PORT) | quote }}
MIN_WINDOW_AGE_MS: {{ (printf "%s" .Values.settlementManagement.config.MIN_WINDOW_AGE_MS) | quote }}
SETTLEMENT_ENDPOINT: {{ (printf "%s%s-%s:%s/%s" "http://" .Release.Name .Values.settlementManagement.config.SETTLEMENTS_SERVICE_NAME .Values.settlementManagement.config.SETTLEMENTS_SERVICE_PORT "v1") | quote }}
OPERATOR_SETTLEMENT_ENDPOINT: {{ (printf "%s%s-%s:%s" "http://" .Release.Name .Values.settlementManagement.config.OPERATOR_SETTLEMENTS_SERVICE_NAME .Values.settlementManagement.config.OPERATOR_SETTLEMENTS_SERVICE_PORT) | quote }}
DB_USER: {{ .Values.db.user | quote }}
DB_HOST: {{ .Values.db.host | quote }}
DB_PORT: {{ .Values.db.port | quote }}
DB_SCHEMA: {{ .Values.db.schema | quote }}
86 changes: 86 additions & 0 deletions finance-portal-settlement-management/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{{- $dbHost := ( .Values.db.host | replace "$release_name" .Release.Name ) -}}

apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "finance-portal-settlement-management.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.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:
selector:
matchLabels:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
initContainers:
{{- if .Values.operatorSettlement.init.enabled }}
- name: operator-settlement-init
image: {{ .Values.operatorSettlement.init.image.repository }}
imagePullPolicy: {{ .Values.operatorSettlement.init.pullPolicy }}
command:
- sh
- "-c"
- {{ (.Values.operatorSettlement.init.command | replace "$db_user" (print .Values.db.user) | replace "$db_password" (print .Values.db.password) | replace "$db_host" $dbHost | replace "$db_database" (print .Values.db.schema) | replace "$db_port" (print .Values.db.port) )| quote }}
{{- end }}
{{- if .Values.settlementManagement.init.enabled }}
- name: settlement-management-init
image: {{ .Values.settlementManagement.init.image.repository }}
imagePullPolicy: {{ .Values.settlementManagement.init.pullPolicy }}
command:
- sh
- "-c"
- {{ (.Values.settlementManagement.init.command | replace "$db_user" (print .Values.db.user) | replace "$db_password" (print .Values.db.password) | replace "$db_host" $dbHost | replace "$db_database" (print .Values.db.schema) | replace "$db_port" (print .Values.db.port) )| quote }}
{{- end }}
containers:
- name: operator-settlement
image: "{{ .Values.operatorSettlement.image.repository }}:{{ .Values.operatorSettlement.image.tag }}"
imagePullPolicy: {{ .Values.operatorSettlement.image.pullPolicy }}
ports:
- name: operator
containerPort: 3000
protocol: TCP
livenessProbe:
httpGet:
path: /
port: operator
readinessProbe:
httpGet:
path: /
port: operator
envFrom:
- configMapRef:
name: {{ template "finance-portal-settlement-management.fullname" . }}
- secretRef:
name: {{ template "finance-portal-settlement-management.fullname" . }}
resources:
- name: settlement-management
image: "{{ .Values.settlementManagement.image.repository }}:{{ .Values.settlementManagement.image.tag }}"
imagePullPolicy: {{ .Values.settlementManagement.image.pullPolicy }}
ports:
- name: management
containerPort: 5000
protocol: TCP
livenessProbe:
httpGet:
path: /
port: management
readinessProbe:
httpGet:
path: /
port: management
envFrom:
- configMapRef:
name: {{ template "finance-portal-settlement-management.fullname" . }}
- secretRef:
name: {{ template "finance-portal-settlement-management.fullname" . }}
imagePullSecrets:
- name: {{ .Values.imageCredentials.name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Values.operatorSettlement.ingress.enabled -}}
{{- $serviceName := include "finance-portal-settlement-management.fullname" . -}}
{{- $operatorSettlementPort := .Values.operatorSettlement.service.port -}}
{{- $operatorSettlementPath := .Values.operatorSettlement.ingress.externalPath -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "finance-portal-settlement-management.fullname" . }}-operator-settlement
labels:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.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 "+" "_" }}
annotations:
{{- range $key, $value := .Values.operatorSettlement.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.operatorSettlement.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: {{ $operatorSettlementPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $operatorSettlementPort }}
{{- end -}}
{{- if .Values.operatorSettlement.ingress.tls }}
tls:
{{ toYaml .Values.operatorSettlement.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
20 changes: 20 additions & 0 deletions finance-portal-settlement-management/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- $dbHost := (.Values.db.host | replace "$release_name" .Release.Name) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "finance-portal-settlement-management.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.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 "+" "_" }}
type: Opaque
data:
DB_PROTOCOL: {{ .Values.db.protocol | b64enc }}
DB_USER: {{ .Values.db.user | b64enc }}
DB_PASSWORD: {{ .Values.db.password | b64enc }}
DB_HOST: {{ $dbHost | b64enc }}
DB_PORT: {{ .Values.db.port | b64enc }}
DB_SCHEMA: {{ .Values.db.schema | b64enc }}

24 changes: 24 additions & 0 deletions finance-portal-settlement-management/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "finance-portal-settlement-management.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.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:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.operatorSettlement.service.port }}
targetPort: operator
protocol: TCP
name: http-operator-settlement
- port: {{ .Values.settlementManagement.service.port }}
targetPort: management
protocol: TCP
name: http-settlement-management
selector:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Values.settlementManagement.ingress.enabled -}}
{{- $serviceName := include "finance-portal-settlement-management.fullname" . -}}
{{- $settlementManagementPort := .Values.settlementManagement.service.port -}}
{{- $settlementManagementPath := .Values.settlementManagement.ingress.externalPath -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "finance-portal-settlement-management.fullname" . }}-settlement-management
labels:
app.kubernetes.io/name: {{ include "finance-portal-settlement-management.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 "+" "_" }}
annotations:
{{- range $key, $value := .Values.settlementManagement.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.settlementManagement.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: {{ $settlementManagementPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $settlementManagementPort }}
{{- end -}}
{{- if .Values.settlementManagement.ingress.tls }}
tls:
{{ toYaml .Values.settlementManagement.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
87 changes: 87 additions & 0 deletions finance-portal-settlement-management/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# Default values shared by all containers
db:
protocol: 'mysql'
host: '$release_name-centralledger-mysql'
port: '3306'
user: 'central_ledger'
password: 'oyMxgZChuu'
schema: 'central_ledger'

service:
type: ClusterIP

imageCredentials:
name: pull-secrets

# Default values for operator-settlement
operatorSettlement:
image:
repository: mojaloop/operator-settlement
tag: latest
pullPolicy: Always

service:
port: 80

init:
enabled: true
image:
repository: mojaloop/operator-settlement
tag: latest
pullPolicy: Always
command: mysql -h $db_host -P $db_port -u $db_user --password=$db_password $db_database < /opt/operator-settlement/init.sql

ingress:
enabled: true
externalPath: /
hosts:
api: operator-settlement.local
annotations:
nginx.ingress.kubernetes.io/rewrite-target: '/'
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
tls:

# Default values for settlement-management
settlementManagement:
image:
repository: mojaloop/settlement-management
tag: latest
pullPolicy: Always

service:
port: 5000

init:
enabled: true
image:
repository: mojaloop/settlement-management
tag: latest
pullPolicy: Always
command: mysql -h $db_host -P $db_port -u $db_user --password=$db_password $db_database < /opt/settlement-management/init.sql

config:
CENTRAL_LEDGER_SERVICE_NAME: 'centralledger-service'
CENTRAL_LEDGER_SERVICE_ADMIN_PORT: '3001'
SETTLEMENTS_SERVICE_NAME: 'centralsettlement'
SETTLEMENTS_SERVICE_PORT: '80'
MIN_WINDOW_AGE_MS: '5000'
OPERATOR_SETTLEMENTS_SERVICE_NAME: 'settlement'
OPERATOR_SETTLEMENTS_SERVICE_PORT: '80'

ingress:
enabled: true
externalPath: /
hosts:
api: settlement-management.local
annotations:
nginx.ingress.kubernetes.io/rewrite-target: '/'
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
tls:
# Secrets must be manually created in the namespace.
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
6 changes: 6 additions & 0 deletions finance-portal/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
appVersion: "1.0"
description: Finance portal service
name: finance-portal
version: 8.6.0
appVersion: "8.6.0"
32 changes: 32 additions & 0 deletions finance-portal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "finance-portal.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 "finance-portal.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 "finance-portal.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
Loading

0 comments on commit 0d2221a

Please sign in to comment.