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

working chart #24

Merged
merged 7 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "1.0"
description: Helm Chart for the Mojaloop (SDK based) Simulator
name: mojaloop-simulator
version: 1.0.1
version: 2.0.0
26 changes: 12 additions & 14 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,31 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "self.name" -}}
{{- define "mojaloop-simulator.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 "self.fullname" -}}
{{- define "mojaloop-simulator.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 "self.chart" -}}
{{- define "mojaloop-simulator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
reusable label block.
*/}}
{{- define "self.labels" }}
app: {{ template "self.fullname" . }}
chart: {{ template "self.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- end -}}
60 changes: 18 additions & 42 deletions helm/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,27 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "self.fullname" . }}-scheme-adapter-config
labels:
{{ include "self.labels" . | indent 4 }}
name: {{ template "mojaloop-simulator.fullname" . }}-scheme-adapter-config
labels:
app: {{ template "mojaloop-simulator.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
AUTO_ACCEPT_QUOTES: {{ .Values.config.schemeAdapter.AUTO_ACCEPT_QUOTES | quote }}
BACKEND_ENDPOINT: "localhost:3000"
CACHE_HOST: localhost
CACHE_PORT: "6379"
CA_CERT_PATH: {{ .Values.config.schemeAdapter.CA_CERT_PATH | quote }}
CHECK_ILP: {{ .Values.config.schemeAdapter.CHECK_ILP | quote }}
DFSP_ID: {{ .Values.config.schemeAdapter.DFSP_ID | quote }}
EXPIRY_SECONDS: {{ .Values.config.schemeAdapter.EXPIRY_SECONDS | quote }}
ILP_SECRET: {{ .Values.config.schemeAdapter.ILP_SECRET | quote }}
JWS_SIGN: {{ .Values.config.schemeAdapter.JWS_SIGN | quote }}
JWS_SIGNING_KEY_PATH: {{ .Values.config.schemeAdapter.JWS_SIGNING_KEY_PATH | quote }}
JWS_VERIFICATION_KEYS_DIRECTORY: {{ .Values.config.schemeAdapter.JWS_VERIFICATION_KEYS_DIRECTORY | quote }}
LOG_INDENT: {{ .Values.config.schemeAdapter.LOG_INDENT | quote }}
MUTUAL_TLS_ENABLED: {{ .Values.config.schemeAdapter.MUTUAL_TLS_ENABLED | quote }}
PEER_ENDPOINT: {{ .Values.config.schemeAdapter.PEER_ENDPOINT | quote }}
SCHEME_NAME: {{ .Values.config.schemeAdapter.SCHEME_NAME | quote }}
SERVER_CERT_PATH: {{ .Values.config.schemeAdapter.SERVER_CERT_PATH | quote }}
SERVER_KEY_PATH: {{ .Values.config.schemeAdapter.SERVER_KEY_PATH | quote }}
VALIDATE_INBOUND_JWS: {{ .Values.config.schemeAdapter.VALIDATE_INBOUND_JWS | quote }}
INBOUND_LISTEN_PORT: "4000"
OUTBOUND_LISTEN_PORT: "4001"
ENABLE_TEST_FEATURES: {{ .Values.config.schemeAdapter.ENABLE_TEST_FEATURES | quote }}

{{- range $k, $v := .Values.config.schemeAdapter.env }}
{{ $k }}: {{ $v | quote }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "self.fullname" . }}-sim-backend-config
labels:
{{ include "self.labels" . | indent 4 }}
name: {{ template "mojaloop-simulator.fullname" . }}-sim-backend-config
labels:
app: {{ template "mojaloop-simulator.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
CA_CERT_PATH: {{ .Values.config.simBackend.CA_CERT_PATH | quote }}
DFSP_ID: {{ .Values.config.simBackend.DFSP_ID | quote }}
FEE_MULTIPLIER: {{ .Values.config.simBackend.FEE_MULTIPLIER | quote }}
HTTPS_ENABLED: {{ .Values.config.simBackend.HTTPS_ENABLED | quote }}
LOG_INDENT: {{ .Values.config.simBackend.LOG_INDENT | quote }}
MODEL_DATABASE: {{ .Values.config.simBackend.MODEL_DATABASE | quote }}
MUTUAL_TLS_ENABLED: {{ .Values.config.simBackend.MUTUAL_TLS_ENABLED | quote }}
OUTBOUND_ENDPOINT: "http://localhost:4001"
RULES_FILE: {{ .Values.config.simBackend.RULES_FILE | quote }}
SCHEME_NAME: {{ .Values.config.simBackend.SCHEME_NAME | quote }}
SERVER_CERT_PATH: {{ .Values.config.simBackend.SERVER_CERT_PATH | quote }}
SERVER_KEY_PATH: {{ .Values.config.simBackend.SERVER_KEY_PATH | quote }}
SQLITE_LOG_FILE: {{ .Values.config.simBackend.SQLITE_LOG_FILE | quote }}
{{- range $k, $v := .Values.config.simBackend.env }}
{{ $k }}: {{ $v | quote }}
{{- end }}
41 changes: 22 additions & 19 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "self.fullname" . }}
labels:
{{ include "self.labels" . | indent 4 }}
name: {{ template "mojaloop-simulator.fullname" . }}
labels:
app: {{ template "mojaloop-simulator.name" . }}
chart: {{ template "mojaloop-simulator.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "self.fullname" . }}
app: {{ template "mojaloop-simulator.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "self.fullname" . }}
app: {{ template "mojaloop-simulator.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ template "self.fullname" . }}-cache
{{- if .Values.config.cache.enabled }}
- name: {{ .Chart.Name }}-cache
image: "{{ .Values.config.cache.image.repository }}:{{ .Values.config.cache.image.tag }}"
imagePullPolicy: {{ .Values.config.cache.image.pullPolicy }}
ports:
- name: redis
containerPort: 6379
protocol: TCP
# ports:
# - name: redis
# containerPort: 6379
# protocol: TCP
{{- if .Values.config.cache.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.config.cache.livenessProbe.initialDelaySeconds }}
Expand All @@ -48,11 +52,12 @@ spec:
command:
- sh
- -c
- redis-cli ping {{ .Values.config.cache.readinessProbe.timeoutSeconds }}
- redis-cli ping {{ .Values.config.cache.livenessProbe.timeoutSeconds }}
{{- end }}
resources:
{{ toYaml .Values.config.cache.resources | indent 12 }}
- name: {{ template "self.fullname" . }}-sim-backend
{{- end }}
- name: {{ .Chart.Name }}-sim-backend
image: "{{ .Values.config.simBackend.image.repository }}:{{ .Values.config.simBackend.image.tag }}"
imagePullPolicy: {{ .Values.config.simBackend.image.pullPolicy }}
ports:
Expand All @@ -69,7 +74,7 @@ spec:
readinessProbe:
httpGet:
path: /
port: 3000
port: 3000
scheme: HTTP
initialDelaySeconds: {{ .Values.config.simBackend.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.config.simBackend.readinessProbe.periodSeconds }}
Expand All @@ -85,10 +90,10 @@ spec:
{{- end }}
envFrom:
- configMapRef:
name: {{ template "self.fullname" . }}-sim-backend-config
name: {{ template "mojaloop-simulator.fullname" . }}-sim-backend-config
resources:
{{ toYaml .Values.config.simBackend.resources | indent 12 }}
- name: {{ template "self.fullname" . }}-scheme-adapter
- name: {{ .Chart.Name }}-scheme-adapter
image: "{{ .Values.config.schemeAdapter.image.repository }}:{{ .Values.config.schemeAdapter.image.tag }}"
imagePullPolicy: {{ .Values.config.schemeAdapter.image.pullPolicy }}
ports:
Expand All @@ -103,7 +108,7 @@ spec:
httpGet:
path: /
port: 4001
scheme: HTTP
scheme: HTTP
initialDelaySeconds: {{ .Values.config.schemeAdapter.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.config.schemeAdapter.readinessProbe.periodSeconds }}
{{- end }}
Expand All @@ -118,13 +123,11 @@ spec:
{{- end }}
envFrom:
- configMapRef:
name: {{ template "self.fullname" . }}-scheme-adapter-config
name: {{ template "mojaloop-simulator.fullname" . }}-scheme-adapter-config
resources:
{{ toYaml .Values.config.schemeAdapter.resources | indent 12 }}

imagePullSecrets:
- name: {{ .Values.config.imagePullSecretName }}

{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand Down
31 changes: 13 additions & 18 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "mojaloop-simulator.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "self.fullname" . }}
labels:
{{ include "self.labels" . | indent 4 }}
name: {{ $fullName }}
labels:
app: {{ template "mojaloop-simulator.name" . }}
chart: {{ template "mojaloop-simulator.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
- http:
paths:
- path: {{ .Values.ingress.paths.schemeadapter }}
- path: /{{ $fullName }}/dfsp(.*)
backend:
serviceName: {{ template "self.fullname" . }}-scheme-adapter
serviceName: {{ $fullName }}-sim
servicePort: inboundapi
- path: {{ .Values.ingress.paths.simbackend }}
- path: /{{ $fullName }}/test(.*)
backend:
serviceName: {{ template "self.fullname" . }}-sim-backend
servicePort: testapi
serviceName: {{ $fullName }}-sim
servicePort: inboundapi
{{- end }}
43 changes: 28 additions & 15 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
{{- $fullName := include "mojaloop-simulator.fullname" . -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "self.fullname" . }}
labels:
{{ include "self.labels" . | indent 4 }}
spec:
type: {{ .Values.config.service.type }}
ports:
{{- range .Values.config.service.ports }}
- port: {{ .port }}
targetPort: {{ .targetPort }}
protocol: {{ .protocol }}
name: {{ .name }}
{{- end }}
selector:
app: {{ template "self.fullname" . }}
name: {{ $fullName }}-sim
labels:
app: {{ template "mojaloop-simulator.name" . }}
chart: {{ template "mojaloop-simulator.chart" . }}
release: {{ .Release.Name }}

heritage: {{ .Release.Service }}
spec:
type: ClusterIP
ports:
- port: 4000
protocol: TCP
name: inboundapi
targetPort: inboundapi
- port: 4001
protocol: TCP
name: outboundapi
targetPort: outboundapi
- port: 3002
protocol: TCP
name: reportapi
targetPort: reportapi
- port: 3003
protocol: TCP
name: testapi
targetPort: testapi
selector:
app: {{ template "mojaloop-simulator.name" . }}
release: {{ .Release.Name }}
Loading