feat: Add AWS CDK project and Helm charts for Beckn-Onix deployment on AWS cloud

This commit is contained in:
Mozammil Khan
2024-09-23 22:57:34 +05:30
parent 5d5e363ccd
commit c683ec3d74
114 changed files with 10018 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: beckn-onix-bpp
description: Beckn ONIX BPP 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.0.0"

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: bpp-client
description: BPP Client 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.0.0"

View File

@@ -0,0 +1,11 @@
{{ "\n" }}
Get the Beckn-ONIX BPP Client (Protocol Server) URL by running these commands:
{{ "\n" }}
{{- if .Values.global.ingress.enabled }}
export INGRESS_HOST=$(kubectl get ingress {{ include "common.name" . }}-ingress -n {{ .Values.namespace }} -o jsonpath="{.status.loadBalancer.ingress[0].hostname}")
{{- if .Values.global.ingress.tls.enabled }}
echo "https://$INGRESS_HOST"
{{- else }}
echo "http://$INGRESS_HOST"
{{- end }}
{{- end }}

View File

@@ -0,0 +1,75 @@
{{/*
Expand the name of the chart or use a provided override.
*/}}
{{- define "common.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name, with truncation to 63 characters.
*/}}
{{- define "common.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 }}
{{/*
Generate a chart name and version label.
*/}}
{{- define "common.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels to be used in all charts.
*/}}
{{- define "common.labels" -}}
helm.sh/chart: {{ include "common.chart" . }}
{{ include "common.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/release: {{ .Release.Revision | quote }}
{{- end }}
{{/*
Common selector labels.
*/}}
{{- define "common.selectorLabels" -}}
app.kubernetes.io/name: {{ include "common.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Helper for creating service account names.
*/}}
{{- define "common.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "common.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Helper for image names and tags.
*/}}
{{- define "common.image" -}}
{{ printf "%s:%s" .Values.image.repository .Values.image.tag }}
{{- end }}
{{/*
Helper for constructing resource names with prefixes or suffixes.
*/}}
{{- define "common.resourceName" -}}
{{- printf "%s-%s" (include "common.fullname" .) .Values.suffix | trunc 63 | trimSuffix "-" }}
{{- end }}

View File

@@ -0,0 +1,135 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.name" . }}-config
namespace: {{ .Values.global.namespace }}
data:
default.yaml: |
# Mandatory
server:
port: {{ .Values.service.port }}
# Redis connection details
cache:
host: {{ .Values.global.redisCache.host }}
port: {{ .Values.global.redisCache.port }}
ttl: "PT10M"
# Optional. Default is 0.
db: 1
# Mongodb connection details
responseCache:
# By default password is picked from MongoDB POD if not supplied through Helm values.
mongoURL: "mongodb://{{ .Values.global.responseCacheMongo.username }}:{{ if .Values.global.responseCacheMongo.password }}{{ .Values.global.responseCacheMongo.password }}{{ else }}{{ include "getSecretValue" (dict "secretName" "mongodb" "namespace" "bpp-common-services" "key" "mongodb-root-password") }}{{ end }}@{{ .Values.global.responseCacheMongo.host }}:{{ .Values.global.responseCacheMongo.port }}/{{ .Values.global.responseCacheMongo.dbname }}?authSource=admin"
ttl: "PT10M"
# synchronous only required for BPP
client:
# Only required for BPP
webhook:
url: "http://sandbox.beckn-onix-aws-cdk.becknprotocol.io"
# Supported mode - bap and bpp
app:
mode: {{ .Values.app.mode }}
# Two types of gateway mode present - client and network
gateway:
mode: {{ .Values.app.gateway.mode }}
inboxQueue: "inbox-bpp"
outboxQueue: "outbox-bpp"
# RabbitMQ connection details
# By default password is picked from RabbitMQ POD if not supplied through Helm values.
amqpURL: "amqp://{{ .Values.global.rabbitMQamqp.username }}:{{ if .Values.global.rabbitMQamqp.password }}{{ .Values.global.rabbitMQamqp.password }}{{ else }}{{ include "getSecretValue" (dict "secretName" "rabbitmq" "namespace" "bpp-common-services" "key" "rabbitmq-password") }}{{ end }}@{{ .Values.global.rabbitMQamqp.host }}:{{ .Values.global.rabbitMQamqp.port }}"
# Mandatory.
actions:
requests:
search:
ttl : "PT15S"
init:
ttl : "PT10S"
select:
ttl : "PT10S"
confirm:
ttl : "PT10S"
status:
ttl : "PT10S"
track:
ttl : "PT10S"
cancel:
ttl : "PT10S"
update:
ttl : "PT10S"
rating:
ttl : "PT10S"
support:
ttl : "PT10S"
get_cancellation_reasons:
ttl : "PT10S"
get_rating_categories:
ttl : "PT10S"
cancellation:
ttl : "PT10S"
responses:
on_search:
ttl: "PT15S"
on_init:
ttl: "PT10S"
on_select:
ttl: "PT10S"
on_confirm:
ttl: "PT10S"
on_status:
ttl: "PT10S"
on_track:
ttl: "PT10S"
on_cancel:
ttl: "PT10S"
on_update:
ttl: "PT10S"
on_rating:
ttl: "PT10S"
on_support:
ttl: "PT10S"
cancellation_reasons:
ttl: "PT10S"
rating_categories:
ttl: "PT10S"
# Mandatory keys
privateKey: {{ .Values.global.bpp.privateKey }}
publicKey: {{ .Values.global.bpp.publicKey }}
# Subscriber details
subscriberId: "{{ .Values.global.subscriber_id | default .Values.global.externalDomain }}"
subscriberUri: "https://{{ .Values.global.externalDomain }}"
# Registry
registryUrl: "{{ .Values.global.registry_url }}/subscribers"
auth: false
# BPP client key ID
uniqueKey: "{{ .Values.global.externalDomain }}.k1"
# Mandatory
city: "std:080"
country: "IND"
# Mandatory
ttl: "PT10M"
# Mandatory
httpTimeout: "PT3S"
httpRetryCount: 2
telemetry:
enabled: false
url: ""
batchSize: 100
# In minutes
syncInterval: 30
redis_db: 3
useLayer2Config: true
mandateLayer2Config: true

View File

@@ -0,0 +1,74 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "common.name" . }}
namespace: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "common.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "common.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "common.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.global.image.repository }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
ports:
- name: bpp-client-port
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- if .Values.livenessProbe }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
{{- end }}
{{- if .Values.readinessProbe }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: bpp-client-config
mountPath: "/usr/src/app/config/default.yaml"
subPath: default.yaml
readOnly: true
# EFS volumes for L2 schemas
- name: bpp-schemas-efs-volume
mountPath: /usr/src/app/schemas
# EBS volumes for logs
- name: bpp-client-logs-ebs-volume
mountPath: /usr/src/app/logs
volumes:
- name: bpp-client-config
configMap:
name: {{ include "common.name" . }}-config
- name: bpp-schemas-efs-volume
persistentVolumeClaim:
claimName: beckn-onix-bpp-efs-pvc
- name: bpp-client-logs-ebs-volume
persistentVolumeClaim:
claimName: {{ include "common.name" . }}-logs-pvc

View File

@@ -0,0 +1,31 @@
{{- if .Values.global.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "common.name" . }}-ingress
namespace: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-1-2017-01
alb.ingress.kubernetes.io/certificate-arn: {{ .Values.global.ingress.tls.certificateArn | quote }}
alb.ingress.kubernetes.io/ssl-redirect: '443'
alb.ingress.kubernetes.io/load-balancer-name: beckn-onix-bpp-client
alb.ingress.kubernetes.io/target-group-attributes: stickiness.enabled=true,stickiness.lb_cookie.duration_seconds=300
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/success-codes: 200,302
spec:
ingressClassName: alb
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "common.name" . }}-svc
port:
number: {{ .Values.service.port }}
{{- end }}

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "common.name" . }}-logs-pvc
namespace: {{ .Values.global.namespace }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: gp2

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "common.name" . }}-svc
namespace: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: bpp-client-port
protocol: TCP
name: http
selector:
{{- include "common.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "common.serviceAccountName" . }}
namespace: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}

View File

@@ -0,0 +1,72 @@
# Default values for registry.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
service:
type: ClusterIP
port: 6002
# Supported app mode - bap or bpp. Gateway mode to be either client or network.
app:
mode: bpp
gateway:
mode: client
resources:
# Adjust it as per desired POD resource demand
requests:
cpu: "0.5"
memory: "1Gi"
limits:
cpu: "0.5"
memory: "1Gi"
livenessProbe: {}
# httpGet:
# path: /
# port: http
readinessProbe: {}
# httpGet:
# path: /
# port: http
# To configure HPA
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 2
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
serviceAccount:
# Specifies whether a service account should be created
create: false
# Automatically mount a ServiceAccount's API credentials?
automount: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podLabels: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
nodeSelector: {}
tolerations: []
affinity: {}

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: bpp-network
description: BPP Network 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.0.0"

View File

@@ -0,0 +1,11 @@
{{ "\n" }}
Get the Beckn-ONIX BPP Network (Protocol Server) URL by running these commands:
{{ "\n" }}
{{- if .Values.global.ingress.enabled }}
export INGRESS_HOST=$(kubectl get ingress {{ include "common.name" . }}-ingress -n {{ .Values.namespace }} -o jsonpath="{.status.loadBalancer.ingress[0].hostname}")
{{- if .Values.global.ingress.tls.enabled }}
echo "https://$INGRESS_HOST"
{{- else }}
echo "http://$INGRESS_HOST"
{{- end }}
{{- end }}

View File

@@ -0,0 +1,95 @@
{{/*
Expand the name of the chart or use a provided override.
*/}}
{{- define "common.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name, with truncation to 63 characters.
*/}}
{{- define "common.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 }}
{{/*
Generate a chart name and version label.
*/}}
{{- define "common.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels to be used in all charts.
*/}}
{{- define "common.labels" -}}
helm.sh/chart: {{ include "common.chart" . }}
{{ include "common.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/release: {{ .Release.Revision | quote }}
{{- end }}
{{/*
Common selector labels.
*/}}
{{- define "common.selectorLabels" -}}
app.kubernetes.io/name: {{ include "common.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Helper for creating service account names.
*/}}
{{- define "common.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "common.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Helper for image names and tags.
*/}}
{{- define "common.image" -}}
{{ printf "%s:%s" .Values.image.repository .Values.image.tag }}
{{- end }}
{{/*
Helper for constructing resource names with prefixes or suffixes.
*/}}
{{- define "common.resourceName" -}}
{{- printf "%s-%s" (include "common.fullname" .) .Values.suffix | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "getSecretValue" -}}
{{- $secretName := .secretName -}}
{{- $namespace := .namespace -}}
{{- $key := .key -}}
{{- $secret := (lookup "v1" "Secret" $namespace $secretName) -}}
{{- if $secret -}}
{{- $data := $secret.data -}}
{{- if $data -}}
{{- $value := index $data $key | b64dec -}}
{{- $value -}}
{{- else -}}
{{- printf "Error: Secret data for %s not found" $key -}}
{{- end -}}
{{- else -}}
{{- printf "Error: Secret %s not found in namespace %s" $secretName $namespace -}}
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,135 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.name" . }}-config
namespace: {{ .Values.global.namespace }}
data:
default.yaml: |
# Mandatory
server:
port: {{ .Values.service.port }}
# Redis connection details
cache:
host: {{ .Values.global.redisCache.host }}
port: {{ .Values.global.redisCache.port }}
ttl: "PT10M"
# Optional. Default is 0.
db: 1
# Mongodb connection details
responseCache:
# By default password is picked from MongoDB POD if not supplied through Helm values.
mongoURL: "mongodb://{{ .Values.global.responseCacheMongo.username }}:{{ if .Values.global.responseCacheMongo.password }}{{ .Values.global.responseCacheMongo.password }}{{ else }}{{ include "getSecretValue" (dict "secretName" "mongodb" "namespace" "bpp-common-services" "key" "mongodb-root-password") }}{{ end }}@{{ .Values.global.responseCacheMongo.host }}:{{ .Values.global.responseCacheMongo.port }}/{{ .Values.global.responseCacheMongo.dbname }}?authSource=admin"
ttl: "PT10M"
client:
# Only required for BPP
webhook:
url: "http://sandbox.beckn-onix-aws-cdk.becknprotocol.io"
# Supported mode - bap and bpp
app:
mode: {{ .Values.app.mode }}
# Two types of gateway mode present - client and network
gateway:
mode: {{ .Values.app.gateway.mode }}
inboxQueue: "inbox-bpp"
outboxQueue: "outbox-bpp"
# RabbitMQ connection details
# By default password is picked from RabbitMQ POD if not supplied through Helm values.
amqpURL: "amqp://{{ .Values.global.rabbitMQamqp.username }}:{{ if .Values.global.rabbitMQamqp.password }}{{ .Values.global.rabbitMQamqp.password }}{{ else }}{{ include "getSecretValue" (dict "secretName" "rabbitmq" "namespace" "bpp-common-services" "key" "rabbitmq-password") }}{{ end }}@{{ .Values.global.rabbitMQamqp.host }}:{{ .Values.global.rabbitMQamqp.port }}"
# Mandatory.
actions:
requests:
search:
ttl : "PT15S"
init:
ttl : "PT10S"
select:
ttl : "PT10S"
confirm:
ttl : "PT10S"
status:
ttl : "PT10S"
track:
ttl : "PT10S"
cancel:
ttl : "PT10S"
update:
ttl : "PT10S"
rating:
ttl : "PT10S"
support:
ttl : "PT10S"
get_cancellation_reasons:
ttl : "PT10S"
get_rating_categories:
ttl : "PT10S"
cancellation:
ttl : "PT10S"
responses:
on_search:
ttl: "PT15S"
on_init:
ttl: "PT10S"
on_select:
ttl: "PT10S"
on_confirm:
ttl: "PT10S"
on_status:
ttl: "PT10S"
on_track:
ttl: "PT10S"
on_cancel:
ttl: "PT10S"
on_update:
ttl: "PT10S"
on_rating:
ttl: "PT10S"
on_support:
ttl: "PT10S"
cancellation_reasons:
ttl: "PT10S"
rating_categories:
ttl: "PT10S"
# Mandatory keys
privateKey: {{ .Values.global.bpp.privateKey }}
publicKey: {{ .Values.global.bpp.publicKey }}
# Subscriber details
subscriberId: "{{ .Values.global.subscriber_id | default .Values.global.externalDomain }}"
subscriberUri: "https://{{ .Values.global.externalDomain }}"
# Registry
registryUrl: "{{ .Values.global.registry_url }}/subscribers"
auth: false
# BPP client key ID
uniqueKey: "{{ .Values.global.externalDomain }}.k1"
# Mandatory
city: "std:080"
country: "IND"
# Mandatory
ttl: "PT10M"
# Mandatory
httpTimeout: "PT3S"
httpRetryCount: 2
telemetry:
enabled: false
url: ""
batchSize: 100
# In minutes
syncInterval: 30
redis_db: 3
useLayer2Config: true
mandateLayer2Config: true

View File

@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "common.name" . }}
namespace: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
strategy:
type: Recreate
{{- end }}
selector:
matchLabels:
{{- include "common.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "common.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "common.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: retain-schemas-content-ebs-volume
image: {{ .Values.global.image.repository }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
command: ['sh', '-c', 'cp -r /usr/src/app/schemas/* /mnt/schemas/']
volumeMounts:
- name: bpp-schemas-efs-volume
mountPath: /mnt/schemas
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.global.image.repository }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
ports:
- name: bpp-net-port
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- if .Values.livenessProbe }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
{{- end }}
{{- if .Values.readinessProbe }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: bpp-network-config
mountPath: "/usr/src/app/config/default.yaml"
subPath: default.yaml
readOnly: true
# EFS volumes for L2 schemas
- name: bpp-schemas-efs-volume
mountPath: /usr/src/app/schemas
# EBS volumes for logs
- name: bpp-network-logs-ebs-volume
mountPath: /usr/src/app/logs
volumes:
- name: bpp-network-config
configMap:
name: {{ include "common.name" . }}-config
- name: bpp-schemas-efs-volume
persistentVolumeClaim:
claimName: beckn-onix-bpp-efs-pvc
- name: bpp-network-logs-ebs-volume
persistentVolumeClaim:
claimName: {{ include "common.name" . }}-logs-pvc

View File

@@ -0,0 +1,31 @@
{{- if .Values.global.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "common.name" . }}-ingress
namespace: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-1-2017-01
alb.ingress.kubernetes.io/certificate-arn: {{ .Values.global.ingress.tls.certificateArn | quote }}
alb.ingress.kubernetes.io/ssl-redirect: '443'
alb.ingress.kubernetes.io/load-balancer-name: beckn-onix-bpp-network
alb.ingress.kubernetes.io/target-group-attributes: stickiness.enabled=true,stickiness.lb_cookie.duration_seconds=300
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/success-codes: 200,302
spec:
ingressClassName: alb
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "common.name" . }}-svc
port:
number: {{ .Values.service.port }}
{{- end }}

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "common.name" . }}-logs-pvc
namespace: {{ .Values.global.namespace }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: gp2

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "common.name" . }}-svc
namespace: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: bpp-net-port
protocol: TCP
name: http
selector:
{{- include "common.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "common.serviceAccountName" . }}
namespace: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}

View File

@@ -0,0 +1,65 @@
replicaCount: 1
service:
type: ClusterIP
port: 6001
# Supported app mode - bap or bpp. Gateway mode to be either client or network.
app:
mode: bpp
gateway:
mode: network
resources:
# Adjust it as per desired POD resource demand
requests:
cpu: "0.5"
memory: "1Gi"
limits:
cpu: "0.5"
memory: "1Gi"
livenessProbe: {}
# httpGet:
# path: /
# port: http
readinessProbe: {}
# httpGet:
# path: /
# port: http
# To configure HPA
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 2
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
serviceAccount:
# Specifies whether a service account should be created
create: false
# Automatically mount a ServiceAccount's API credentials?
automount: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podLabels: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
# Default to externalDomain value
subscriber_id:

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: beckn-onix-bpp-efs-pvc
namespace: {{ .Values.global.namespace }}
spec:
accessModes:
- ReadWriteMany
storageClassName: {{ include "common.name" . }}-efs-storageclass
resources:
requests:
storage: 5Gi

View File

@@ -0,0 +1,9 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: {{ include "common.name" . }}-efs-storageclass
provisioner: efs.csi.aws.com
parameters:
provisioningMode: efs-ap
fileSystemId: {{ .Values.global.efs.fileSystemId }}
directoryPerms: "755"

View File

@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.global.namespace }}
labels:
{{- include "common.labels" . | nindent 4 }}

View File

@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: beckn-onix-bpp-secret
namespace: {{ .Values.global.namespace }}
type: Opaque
data:
privateKey: {{ .Values.global.bpp.publicKey | b64enc | quote }}
publicKey: {{ .Values.global.bpp.privateKey | b64enc | quote }}

View File

@@ -0,0 +1,70 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"global": {
"type": "object",
"properties": {
"externalDomain": {
"type": "string",
"description": "The external domain for the BPP network."
},
"registry_url": {
"type": "string",
"description": "The URL for the registry."
},
"ingress": {
"type": "object",
"properties": {
"tls": {
"type": "object",
"properties": {
"certificateArn": {
"type": "string",
"description": "The ARN of the TLS certificate for ingress."
}
},
"required": ["certificateArn"],
"description": "TLS configuration for ingress."
}
},
"required": ["tls"],
"description": "Ingress-related configuration."
},
"efs": {
"type": "object",
"properties": {
"fileSystemId": {
"type": "string",
"description": "The EFS FileSystem ID."
}
},
"required": ["fileSystemId"],
"description": "EFS-related configuration."
},
"bpp": {
"type": "object",
"properties": {
"privateKey": {
"type": "string",
"description": "The private key for BPP."
},
"publicKey": {
"type": "string",
"description": "The public key for BPP."
}
},
"required": ["privateKey", "publicKey"],
"description": "Keys for BPP, including both private and public keys."
}
},
"required": [
"externalDomain",
"registry_url",
"ingress",
"efs",
"bpp"
]
}
}
}

View File

@@ -0,0 +1,63 @@
# Default values for registry.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
global:
namespace: beckn-onix-bpp
image:
repository: fidedocker/protocol-server
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
# tag: ""
# Redis connection details
redisCache:
host: redis-master.bpp-common-services.svc.cluster.local
port: 6379
# Mongodb connection details
responseCacheMongo:
host: mongodb.bpp-common-services.svc.cluster.local
port: 27017
dbname: protocol_server
username: root
password:
# RabbitMQ connection details
rabbitMQamqp:
host: rabbitmq.bpp-common-services.svc.cluster.local
port: 5672
username: beckn
password:
# Ingress definition for AWS Application Loadbalancer.
# This is required for each component available over the public network.
ingress:
enabled: true # If enabled, ALB will be provisioned as per ingress.yaml. Without ingress service will be scoped to K8s cluster.
tls:
# Must be set while installing Helm chart. SSL certificate ARN (e.g. arn:aws:acm:region:account-id:certificate/certificate-id) from AWS Certificate Manager - https://aws.amazon.com/certificate-manager/
certificateArn:
sslRedirect: true # Set to true to enable SSL redirection, useful for UI redirection.
# Must be set while installing Helm chart
externalDomain:
registry_url:
bpp:
privateKey:
publicKey:
efs:
fileSystemId:
# BPP subscribe_id. Default to externalDomain value.
subscriber_id:
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
nodeSelector: {}
tolerations: []
affinity: {}