Skip to content

Commit

Permalink
Copy from personal repo
Browse files Browse the repository at this point in the history
  • Loading branch information
anugram committed Feb 29, 2024
1 parent bb5f483 commit 7aadafa
Show file tree
Hide file tree
Showing 105 changed files with 3,338 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
.vscode/
.vscode/
demos/
23 changes: 23 additions & 0 deletions docs/.helmignore
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/
24 changes: 24 additions & 0 deletions docs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: cdsp
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.0.0"
Binary file added docs/banking-api-1.0.0.tgz
Binary file not shown.
23 changes: 23 additions & 0 deletions docs/charts/banking-api/.helmignore
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/
24 changes: 24 additions & 0 deletions docs/charts/banking-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: banking-api
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: 1.0.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"
22 changes: 22 additions & 0 deletions docs/charts/banking-api/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "banking-api.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "banking-api.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "banking-api.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "banking-api.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions docs/charts/banking-api/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "banking-api.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 "banking-api.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 "banking-api.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "banking-api.labels" -}}
helm.sh/chart: {{ include "banking-api.chart" . }}
{{ include "banking-api.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "banking-api.selectorLabels" -}}
app.kubernetes.io/name: {{ include "banking-api.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "banking-api.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "banking-api.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
81 changes: 81 additions & 0 deletions docs/charts/banking-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: {{.Values.runlabel}}
name: dpg-bank-api-server-deployment
spec:
template:
metadata:
name: {{.Values.deployment.name}}
labels:
run: {{.Values.runlabel}}
spec:
containers:
- image: {{.Values.deployment.appimage}}
imagePullPolicy: IfNotPresent
name: {{.Values.deployment.appimagename}}
- image: {{.Values.deployment.dpgimage}}
imagePullPolicy: IfNotPresent
name: {{.Values.deployment.dpgimagename}}
env:
- name: KMS
valueFrom:
configMapKeyRef:
name: {{.Values.configuration.configmapname}}
key: KMS
- name: CERT_PATH
valueFrom:
secretKeyRef:
name: dpg-secret
key: server.crt
- name: KEY_PATH
valueFrom:
secretKeyRef:
name: dpg-secret
key: server.key
- name: TLS_ENABLED
valueFrom:
configMapKeyRef:
name: {{.Values.configuration.configmapname}}
key: TLS_ENABLED
- name: REG_TOKEN
valueFrom:
configMapKeyRef:
name: {{.Values.configuration.configmapname}}
key: REG_TOKEN
- name: DESTINATION_URL
valueFrom:
configMapKeyRef:
name: {{.Values.configuration.configmapname}}
key: DESTINATION_URL

replicas: {{.Values.deployment.replicas}}
selector:
matchLabels:
run: {{.Values.runlabel}}

---
apiVersion: v1
data:
server.crt: {{.Values.configuration.servercrt}}
server.key: {{.Values.configuration.serverkey}}
kind: Secret
metadata:
name: {{.Values.configuration.secretname}}
type: Opaque
---

apiVersion: v1
items:
- apiVersion: v1
data:
TLS_ENABLED: {{.Values.configuration.tlsenabled | quote}}
KMS: {{.Values.configuration.kms}}
REG_TOKEN: {{.Values.configuration.reg_token}}
DESTINATION_URL: {{.Values.configuration.appurl}}
kind: ConfigMap
metadata:
name: {{.Values.configuration.configmapname}}
kind: List
metadata:
28 changes: 28 additions & 0 deletions docs/charts/banking-api/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "banking-api.fullname" . }}
labels:
{{- include "banking-api.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "banking-api.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions docs/charts/banking-api/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{.Values.service.name}}
spec:
selector:
run: {{.Values.runlabel}}
type: {{.Values.service.type}}
ports:
- name: {{.Values.service.appname}}
port: {{.Values.service.appPort}}
targetPort: {{.Values.service.apptargetPort}}
nodePort: {{.Values.service.appnodePort}}
12 changes: 12 additions & 0 deletions docs/charts/banking-api/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "banking-api.serviceAccountName" . }}
labels:
{{- include "banking-api.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions docs/charts/banking-api/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "banking-api.fullname" . }}-test-connection"
labels:
{{- include "banking-api.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "banking-api.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
43 changes: 43 additions & 0 deletions docs/charts/banking-api/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
runlabel: banking-app-api-server

deployment:
name: dpg-banking-app-api
appimagename: api-container
dpgimagename: dpg-container
replicas: 1
appimage: localhost:5000/bank_app_api
dpgimage: localhost:5000/ciphertrust-data-protection-gateway

service:
name: api-svc
type: NodePort
appname: api-port
appnodePort: 32001
appPort: 8990
apptargetPort: 8990

configuration:
secretname: dpg-secret
configmapname: dpg-configmap
kms: 192.168.2.213
appurl: http://localhost:8080
tlsenabled: false
reg_token: FkjpFN7BWCl1dLgQN0fCb1sfvqYcOLmZD9HkZ1JhdBOZQTTeUft0ZIqUrwzWRsLo

This comment has been minimized.

Copy link
@anugram

anugram Feb 29, 2024

Author Contributor

dummy credential and private IP for KMS


servercrt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURIakNDQWdZQ0ZFa0M2a3puOXFPenpPVFEyRVN1QW41UnVFNnpNQTBHQ1NxR1NJYjNEUUVCQ3dVQU1GTXgKQ3pBSkJnTlZCQVlUQWtsT01STXdFUVlEVlFRSURBcFRiMjFsTFZOMFlYUmxNU0V3SHdZRFZRUUtEQmhKYm5SbApjbTVsZENCWGFXUm5hWF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aHoyNnJWT3lqM2ZrbTRZVUhkNApmR3ZacUFZaDQ0YS9KZVlkdVVtZDVyb1V5UlQ1WDNTMnFSV3hCOHhCTGRXUUl4WGRzNVFxaFNVb2ZjMTU5ZmNSCk9LRmVaUUtCZ0Fpc2JBem5JZXVPNUJoTkszWEF0WjhDK2c1TmpJaVdPRXQ1TlNtVkV3MVdZV2RKMjN2OEpTWmQKa3BCRjV6emhsdVpEaTV0TGxmYTdXYmtUSU0rTHNaKzJpYVF6cmZ0TXdDNXNrQUMzTU5oR282ZDg3VnhMWlZNUQpzMWk4NHYzeUJmZXRhR09SZlZvQitLdnNKOEJNWS9pQkNYa2JnblRjaWpDeXFDRWQxcEVICi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==

This comment has been minimized.

Copy link
@anugram

anugram Feb 29, 2024

Author Contributor

These are dummy credentials and are copied from our ThalesDocs documentation of DPG itself


serviceAccount:
create: true
annotations: {}
name: ""

ingress:
enabled: true

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 1
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
Loading

0 comments on commit 7aadafa

Please sign in to comment.