-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PM-1888 - Add kyc-management-app helm chart
- Loading branch information
1 parent
aa5aa49
commit feb5c91
Showing
13 changed files
with
639 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,6 @@ | ||
dependencies: | ||
- name: postgresql | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 15.5.20 | ||
digest: sha256:363767f938fc92c495d11c0bf1e65e662b0fe257703a6ce77e3a6adcbf0933a3 | ||
generated: "2024-07-30T16:50:31.242761-04:00" |
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,30 @@ | ||
apiVersion: v2 | ||
name: kyc-management-app | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
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: 0.1.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: "1.16.0" | ||
|
||
dependencies: | ||
- name: postgresql | ||
version: "*" | ||
repository: "https://charts.bitnami.com/bitnami" | ||
condition: postgresql.enabled |
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,101 @@ | ||
# kyc-management-app | ||
|
||
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square) | ||
|
||
A Helm chart for Kubernetes | ||
|
||
## Requirements | ||
|
||
| Repository | Name | Version | | ||
|------------|------|---------| | ||
| https://charts.bitnami.com/bitnami | postgresql | * | | ||
|
||
## Prerequisites | ||
|
||
Before using this Helm chart, you should have the following prerequisites: | ||
|
||
- Access to Kubernetes cluster (If needed contact your friendly neighbourhood DevOps engineer) | ||
- Helm >= v3.14.3 | ||
- (**Optional**) helmfile >= v0.162.0 to install this chart | ||
|
||
## Installation | ||
|
||
> Note: **examples** can be found in the repository | ||
To install this Helm chart, the easiest is to create a helmfile.yaml with needed values and run: | ||
|
||
``` | ||
helmfile template | ||
helmfile apply | ||
``` | ||
|
||
Or use helmfile only to generate resources and apply them with kubectl like so: | ||
|
||
``` | ||
helmfile template | kubectl -f - | ||
``` | ||
|
||
Verify that the chart is deployed successfully: | ||
|
||
> Note: `kubectl` is a better suited tool for this | ||
``` | ||
helmfile status | ||
``` | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| affinity | object | `{}` | Affinity rules | | ||
| databaseName | string | `"kyc"` | | | ||
| deploymentAnnotations | object | `{}` | Annotations to add to deployments | | ||
| fullnameOverride | string | `""` | The full release name override | | ||
| image.pullPolicy | string | `"IfNotPresent"` | The pullPolicy used when pulling the image | | ||
| image.repository | string | `"673156464838.dkr.ecr.us-west-2.amazonaws.com/kyc-management-app"` | The repository of the image | | ||
| image.tag | string | `"0.1.4"` | The tag of the image. Overrides the image tag whose default is the chart appVersion. | | ||
| imagePullSecrets | list | `[]` | The secrets used to pull the image | | ||
| ingress.annotations | object | `{}` | The Ingress Annotations | | ||
| ingress.className | string | `""` | The Ingress Class Name to use | | ||
| ingress.enabled | bool | `false` | Whether to create an Ingress | | ||
| ingress.hosts | list | `[]` | The Ingress Hosts | | ||
| ingress.tls | list | `[]` | The TLS configuration | | ||
| kyc.api.authUrl | string | `"https://auth-sandbox.hakata.io"` | | | ||
| kyc.api.baseUrl | string | `"https://api-sandbox.hakata.io"` | | | ||
| kyc.api.clientId | string | `""` | | | ||
| kyc.api.clientSecret | string | `""` | | | ||
| kycManagementApp.app.envVars | object | `{}` | The ENV vars to set on the app container | | ||
| kycManagementApp.app.port | int | `3000` | The port of the app service | | ||
| kycManagementApp.dex.configBase64 | string | `""` | The configuration file for dex in base64 format | | ||
| kycManagementApp.dex.envVars | object | `{}` | The ENV vars to set on the dex container | | ||
| kycManagementApp.dex.port | int | `5556` | The port of the dex service | | ||
| livenessProbe | string | `nil` | The Liveness Probe | | ||
| nameOverride | string | `""` | The release name override | | ||
| nodeSelector | object | `{}` | Node selector labels | | ||
| podAnnotations | object | `{}` | Annotations to add to the pods | | ||
| podLabels | object | `{}` | The labels to add to the pods | | ||
| podSecurityContext | object | `{}` | The Pod Security Context | | ||
| postgresql.auth.database | string | `"kyc"` | Database name | | ||
| postgresql.auth.enablePostgresUser | bool | `false` | Enable the default postgres user | | ||
| postgresql.auth.password | string | `"password"` | Password for the database | | ||
| postgresql.auth.username | string | `"username"` | Username for the database | | ||
| postgresql.enabled | bool | `true` | Enable local postgresql database server | | ||
| postgresql.primary.persistence | object | `{"enabled":false,"size":"8Gi","storageClass":""}` | Extended configuration to configure postgresql server extendedConfiguration: | max_connections=500 max_locks_per_transaction=100 max_pred_locks_per_relation=100 max_pred_locks_per_transaction=5000 max_wal_size=2048 | | ||
| postgresql.primary.persistence.enabled | bool | `false` | Enable the persistence for the postgresql server | | ||
| postgresql.primary.persistence.size | string | `"8Gi"` | Size of the postgresql server volume | | ||
| postgresql.primary.persistence.storageClass | string | `""` | Storage class for the postgresql server volume | | ||
| postgresql.primary.resourcesPreset | string | `"nano"` | Resources preset to set resource requests and limits | | ||
| readinessProbe | string | `nil` | The Readiness Probe | | ||
| replicaCount | int | `1` | The number of replicas | | ||
| resources | object | `{}` | Resource limitations for the pods | | ||
| securityContext | object | `{}` | The Security Context | | ||
| service.port | int | `3000` | The port of the service | | ||
| service.type | string | `"ClusterIP"` | The type of service to create | | ||
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | | ||
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? | | ||
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | | ||
| serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template | | ||
| tolerations | list | `[]` | Tolerations | | ||
| volumeMounts | list | `[]` | Additional volumeMounts on the output Deployment definition. | | ||
| volumes | list | `[]` | Additional volumes on the output Deployment definition. | | ||
|
Binary file not shown.
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,66 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "kyc-management-app.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 "kyc-management-app.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 "kyc-management-app.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "kyc-management-app.labels" -}} | ||
helm.sh/chart: {{ include "kyc-management-app.chart" . }} | ||
{{ include "kyc-management-app.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "kyc-management-app.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "kyc-management-app.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "kyc-management-app.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "kyc-management-app.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "postgresUri" -}} | ||
postgres://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password}}@{{ include "postgresql.v1.primary.fullname" .Subcharts.postgresql }}:{{- .Values.postgresql.primary.service.ports.postgresql -}}/{{.Values.databaseName}} | ||
{{- end }} |
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,111 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "kyc-management-app.fullname" . }} | ||
{{- with .Values.deploymentAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
labels: | ||
{{- include "kyc-management-app.labels" . | nindent 4 }} | ||
spec: | ||
{{- if not .Values.autoscaling.enabled }} | ||
replicas: {{ .Values.replicaCount }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "kyc-management-app.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "kyc-management-app.labels" . | nindent 8 }} | ||
{{- with .Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "kyc-management-app.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
initContainers: | ||
- name: init-db | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
env: | ||
- name: DATABASE_URL | ||
value: {{ include "postgresUri" . | quote }} | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
runAsUser: 0 | ||
command: | ||
- sh | ||
- -c | ||
- | | ||
apk --update add postgresql-client | ||
psql $DATABASE_URL -f /db/prisma/migrations/0_init/migration.sql --set=ON_ERROR_STOP=1 | ||
psql $DATABASE_URL -f /db/seed.sql --set=ON_ERROR_STOP=1 | ||
echo DB migration done. | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
env: | ||
- name: DATABASE_URL | ||
value: {{ include "postgresUri" . | quote }} | ||
- name: KYC_API_BASE_URL | ||
value: {{.Values.kyc.api.baseUrl}} | ||
- name: KYC_API_AUTH_URL | ||
value: {{.Values.kyc.api.authUrl}} | ||
- name: KYC_API_CLIENT_ID | ||
value: {{.Values.kyc.api.clientId}} | ||
- name: KYC_API_CLIENT_SECRET | ||
value: {{.Values.kyc.api.clientSecret}} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
{{- toYaml .Values.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml .Values.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumeMounts: | ||
# - name: dex | ||
# mountPath: "/etc/dex" | ||
# readOnly: true | ||
{{- with .Values.volumeMounts }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
volumes: | ||
- name: dex | ||
secret: | ||
secretName: {{ include "kyc-management-app.fullname" . }} | ||
optional: false | ||
items: | ||
- key: dex.yaml | ||
path: config.yaml | ||
{{- with .Values.volumes }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
Oops, something went wrong.