feat: Add AWS CDK project and Helm charts for Beckn-Onix deployment on AWS cloud
This commit is contained in:
@@ -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 }}
|
||||
@@ -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 }}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 }}
|
||||
@@ -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
|
||||
@@ -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 }}
|
||||
@@ -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 }}
|
||||
Reference in New Issue
Block a user