feat: Add AWS CDK project and Helm charts for Beckn-Onix deployment on AWS cloud
This commit is contained in:
24
aws-cdk/helm/gateway/Chart.yaml
Normal file
24
aws-cdk/helm/gateway/Chart.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: v2
|
||||
name: beckn-onix-gateway
|
||||
description: Beckn ONIX Gateway 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"
|
||||
9
aws-cdk/helm/gateway/templates/NOTES.txt
Normal file
9
aws-cdk/helm/gateway/templates/NOTES.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Get the Beckn-ONIX Gateway URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
export INGRESS_HOST=$(kubectl get ingress {{ include "common.name" . }}-ingress -n {{ .Values.namespace }} -o jsonpath="{.status.loadBalancer.ingress[0].hostname}"){{ "\n" }}
|
||||
{{- if .Values.ingress.tls.enabled }}
|
||||
echo "https://$INGRESS_HOST"{{ "\n" }}
|
||||
{{- else }}
|
||||
echo "http://$INGRESS_HOST"{{ "\n" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
75
aws-cdk/helm/gateway/templates/_helpers.tpl
Normal file
75
aws-cdk/helm/gateway/templates/_helpers.tpl
Normal 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 }}
|
||||
18
aws-cdk/helm/gateway/templates/configmap-gtw-onixjson.yaml
Normal file
18
aws-cdk/helm/gateway/templates/configmap-gtw-onixjson.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.name" . }}-onixjson-config
|
||||
namespace: {{ .Values.namespace }}
|
||||
data:
|
||||
onix.json: |
|
||||
{
|
||||
"core_version": "1.1.0",
|
||||
"registry_id": "{{ .Values.registry_url | default "localhost" | replace "http://" "" | replace "https://" "" }}..LREG",
|
||||
"search_provider_id": "{{ .Values.externalDomain }}",
|
||||
"self_registration_supported": true,
|
||||
"subscription_needed_post_registration": true,
|
||||
"base_url": "{{ .Values.registry_url | default "localhost" }}",
|
||||
"registry_url": "{{ .Values.registry_url | default "localhost" }}/subscribers",
|
||||
"extension_package": "in.succinct.beckn.boc",
|
||||
"wild_card": ""
|
||||
}
|
||||
34
aws-cdk/helm/gateway/templates/configmap-swf-properties.yaml
Normal file
34
aws-cdk/helm/gateway/templates/configmap-swf-properties.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.name" . }}-config
|
||||
namespace: {{ .Values.namespace }}
|
||||
data:
|
||||
swf.properties: |
|
||||
swf.load.complete.config.tables.if.count.less.than=500
|
||||
swf.user.password.encrypted=false
|
||||
swf.plugins.background.core.workers.numThreads=3
|
||||
swf.application.authentication.required=false
|
||||
swf.application.requires.registration=true
|
||||
swf.host={{ .Values.externalDomain }}
|
||||
swf.external.port=443
|
||||
swf.external.scheme=https
|
||||
swf.jdbc.dbschema=public
|
||||
swf.jdbc.dbschema.setonconnection=true
|
||||
swf.jdbc.set.dbschema.command=set search_path to 'public'
|
||||
swf.jdbc.url=jdbc:postgresql://{{ .Values.database.host }}/{{ .Values.database.dbname }}
|
||||
swf.jdbc.driver=org.postgresql.Driver
|
||||
swf.jdbc.userid={{ .Values.database.username }}
|
||||
swf.jdbc.password={{ .Values.database.password }}
|
||||
swf.jdbc.readOnly=false
|
||||
swf.api.keys.case=SNAKE
|
||||
swf.api.root.required=false
|
||||
swf.encryption.support=false
|
||||
swf.ftl.dir=src/main/resources/templates
|
||||
beckn.auth.enabled=true
|
||||
in.succinct.beckn.gateway.subscriber_id={{ .Values.externalDomain }}
|
||||
in.succinct.beckn.gateway.public_key_id={{ .Values.externalDomain }}.k1
|
||||
in.succinct.onet.country.iso.3=IND
|
||||
in.succinct.onet.country.iso.2=IN
|
||||
in.succinct.onet.name=onix
|
||||
|
||||
70
aws-cdk/helm/gateway/templates/deployment.yaml
Normal file
70
aws-cdk/helm/gateway/templates/deployment.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "common.name" . }}
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- 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 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: {{ .Values.image.repository }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: gateway-port
|
||||
containerPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
- name: sec-gtw-port
|
||||
containerPort: {{ .Values.service.secondaryPort }}
|
||||
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: gateway-config
|
||||
mountPath: "/gateway/overrideProperties/config/swf.properties"
|
||||
subPath: swf.properties
|
||||
readOnly: true
|
||||
- name: onixjson-config
|
||||
mountPath: "/gateway/overrideProperties/config/networks/onix.json"
|
||||
subPath: onix.json
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: gateway-config
|
||||
configMap:
|
||||
name: {{ include "common.name" . }}-config
|
||||
- name: onixjson-config
|
||||
configMap:
|
||||
name: {{ include "common.name" . }}-onixjson-config
|
||||
32
aws-cdk/helm/gateway/templates/ingress.yaml
Normal file
32
aws-cdk/helm/gateway/templates/ingress.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "common.name" . }}-ingress
|
||||
namespace: {{ .Values.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.ingress.tls.certificateArn | quote }}
|
||||
alb.ingress.kubernetes.io/ssl-redirect: '443'
|
||||
alb.ingress.kubernetes.io/group.name: beckn-onix-gateway
|
||||
alb.ingress.kubernetes.io/load-balancer-name: beckn-onix-gateway
|
||||
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 }}
|
||||
6
aws-cdk/helm/gateway/templates/namespace.yaml
Normal file
6
aws-cdk/helm/gateway/templates/namespace.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
16
aws-cdk/helm/gateway/templates/service.yaml
Normal file
16
aws-cdk/helm/gateway/templates/service.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "common.name" . }}-svc
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: gateway-port
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "common.selectorLabels" . | nindent 4 }}
|
||||
14
aws-cdk/helm/gateway/templates/serviceaccount.yaml
Normal file
14
aws-cdk/helm/gateway/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "registry.serviceAccountName" . }}
|
||||
namespace: {{- toYaml .Values.namespace | nindent 2 }}
|
||||
labels:
|
||||
{{- include "registry.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
|
||||
{{- end }}
|
||||
53
aws-cdk/helm/gateway/values.schema.json
Normal file
53
aws-cdk/helm/gateway/values.schema.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"externalDomain": {
|
||||
"type": "string",
|
||||
"description": "The external domain for the gateway."
|
||||
},
|
||||
"registry_url": {
|
||||
"type": "string",
|
||||
"description": "The URL of the registry."
|
||||
},
|
||||
"database": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"host": {
|
||||
"type": "string",
|
||||
"description": "The hostname of the RDS PostgreSQL database."
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"description": "The password for the RDS PostgreSQL database."
|
||||
}
|
||||
},
|
||||
"required": ["host", "password"],
|
||||
"description": "Database configuration for the gateway."
|
||||
},
|
||||
"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."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"externalDomain",
|
||||
"registry_url",
|
||||
"database",
|
||||
"ingress"
|
||||
]
|
||||
}
|
||||
101
aws-cdk/helm/gateway/values.yaml
Normal file
101
aws-cdk/helm/gateway/values.yaml
Normal file
@@ -0,0 +1,101 @@
|
||||
# Default values for registry.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
replicaCount: 1
|
||||
namespace: beckn-onix-gateway
|
||||
|
||||
image:
|
||||
repository: fidedocker/gateway
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
# tag: ""
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
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
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 4030
|
||||
secondaryPort: 4000
|
||||
|
||||
# Ingress definition for AWS Application Loadbalancer
|
||||
ingress:
|
||||
enabled: true # If enabled, HTTP port 80 listener is open on AWS ALB. Set to false to disable Ingress. Without ingress service will be scoped to K8s cluster.
|
||||
tls:
|
||||
enabled: false # Set to true to enable TLS with Aamzon Certificate Manager (ACM)
|
||||
certificateArn: arn:aws:acm:ap-south-1:365975017663:certificate/04d1ef71-8407-495b-82f0-4eded8694189 # SSL certificate location if tls is enabled
|
||||
sslRedirect: true # Set to true to enable SSL redirection
|
||||
|
||||
resources:
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
requests:
|
||||
cpu: "0.5"
|
||||
memory: "1Gi"
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: "2Gi"
|
||||
|
||||
livenessProbe: {}
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: http
|
||||
readinessProbe: {}
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: http
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 2
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
# Gateway AWS RDS Postgres connection details
|
||||
database:
|
||||
host:
|
||||
dbname: gateway
|
||||
username: postgres
|
||||
password:
|
||||
|
||||
registry_url:
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
# Gateway external domain/sub-domain value. Supply the actual value during Helm install "--set externalDomain=<domain-name>"
|
||||
externalDomain:
|
||||
|
||||
Reference in New Issue
Block a user