Skip to content

Commit

Permalink
Helm charts Beneficiary Portal: Added API and UI components
Browse files Browse the repository at this point in the history
Signed-off-by: Lalith Kota <kotalalith@gmail.com>
  • Loading branch information
lalithkota committed Jul 5, 2024
1 parent cd7ceb9 commit dc39a20
Show file tree
Hide file tree
Showing 20 changed files with 996 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/*.tgz
Chart.lock
23 changes: 23 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/.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/
12 changes: 12 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: openg2p-pbms-beneficiary-portal
description: A Helm chart for OpenG2P PBMS Beneficiary Portal
type: application
version: 0.0.0-develop
dependencies:
- name: common
version: 2.x.x
repository: oci://registry-1.docker.io/bitnamicharts
icon: https://openg2p.github.io/openg2p-helm/openg2p-logo.png
annotations:
catalog.cattle.io/display-name: "OpenG2P PBMS Beneficiary Portal"
3 changes: 3 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OpenG2P PBMS Beneficiary Portal Helm Chart

This chart installs OpenG2P Beneficiary Portal (FastAPI based portal, not odoo based).
1 change: 1 addition & 0 deletions charts/openg2p-pbms-beneficiary-portal/app-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Refer to deployment guide [here](https://docs.openg2p.org/pbms/deployment).
10 changes: 10 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/questions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
questions:
- variable: hostname
description: Hostname under which beneficiary portal should be accessible
type: string
label: Beneficiary Portal Hostname

- variable: global.esignetBaseUrl
description: Base URL of eSignet. Beneficiary Portal will consider this esignet as valid Authenticator.
type: string
label: eSignet Base URL
37 changes: 37 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{/*
Create the name of the service account to use
*/}}
{{- define "pbms.beneficiary-portal.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Render Env values section
*/}}
{{- define "pbms.beneficiary-portal.baseEnvVars" -}}
{{- $context := .context -}}
{{- range $k, $v := .envVars }}
- name: {{ $k }}
{{- if or (kindIs "int64" $v) (kindIs "float64" $v) (kindIs "bool" $v) }}
value: {{ $v | quote }}
{{- else if kindIs "string" $v }}
value: {{ include "common.tplvalues.render" ( dict "value" $v "context" $context ) | squote }}
{{- else }}
valueFrom: {{- include "common.tplvalues.render" ( dict "value" $v "context" $context ) | nindent 4}}
{{- end }}
{{- end }}
{{- end -}}

{{- define "pbms.beneficiary-portal.envVars" -}}
{{- $envVars := merge (deepCopy .Values.envVars) (deepCopy .Values.envVarsFrom) -}}
{{- include "pbms.beneficiary-portal.baseEnvVars" (dict "envVars" $envVars "context" $) }}
{{- end -}}

{{- define "pbms.beneficiary-portal.ui.envVars" -}}
{{- $envVars := merge (deepCopy .Values.selfserviceUi.envVars) (deepCopy .Values.selfserviceUi.envVarsFrom) -}}
{{- include "pbms.beneficiary-portal.baseEnvVars" (dict "envVars" $envVars "context" $) }}
{{- end -}}
99 changes: 99 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
{{- if .Values.updateStrategy }}
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
template:
metadata:
{{- if .Values.podAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.podAnnotations "context" $ ) | nindent 4 }}
{{- end }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.podLabels "context" $) | nindent 8 }}
spec:
serviceAccountName: {{ include "pbms.beneficiary-portal.serviceAccountName" . }}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.selfserviceUi.image) "global" .Values.global) -}}
{{- if .Values.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- if .Values.podSecurityContext.enabled }}
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.initContainers }}
initContainers:
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: pbms-beneficiary-portal-api
image: {{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) }}
{{- end }}
{{- if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) }}
{{- end }}
env:
{{- include "pbms.beneficiary-portal.envVars" . | nindent 12 }}
ports:
- name: http
containerPort: {{ .Values.containerPort }}
{{- if .Values.resources }}
resources: {{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if .Values.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }}
{{- else if .Values.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.extraVolumeMounts }}
volumeMounts: {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.extraVolumes }}
volumes: {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- range .Values.extraDeploy }}
---
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
{{- end }}
38 changes: 38 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/templates/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.istio.enabled }}
{{- if .Values.istio.gateway.enabled }}
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
selector:
{{ toYaml .Values.istio.gateway.ingressController | nindent 4 }}
servers:
{{- if .Values.istio.gateway.httpEnabled }}
- port:
name: http2
number: 8080
protocol: HTTP2
hosts:
- {{ default .Values.hostname .Values.istio.gateway.host | quote }}
{{- if .Values.istio.gateway.httpTlsRedirect }}
tls:
httpsRedirect: true
{{- end }}
{{- end }}
{{- if .Values.istio.gateway.httpsEnabled }}
- port:
name: https
number: 8443
protocol: HTTPS
hosts:
- {{ default .Values.hostname .Values.istio.gateway.host | quote }}
tls:
{{ toYaml (omit .Values.istio.gateway.tls "enabled") | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
34 changes: 34 additions & 0 deletions charts/openg2p-pbms-beneficiary-portal/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "common.names.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{{- if .Values.selfserviceUi.enabled }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "common.names.fullname" . }}-ui
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.selfserviceUi.replicaCount }}
{{- if .Values.selfserviceUi.updateStrategy }}
strategy: {{- toYaml .Values.selfserviceUi.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" .Values.selfserviceUi.podLabels "context" $) | nindent 6 }}
template:
metadata:
{{- if .Values.selfserviceUi.podAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.selfserviceUi.podAnnotations "context" $ ) | nindent 4 }}
{{- end }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.selfserviceUi.podLabels "context" $) | nindent 8 }}
spec:
serviceAccountName: {{ include "pbms.beneficiary-portal.serviceAccountName" . }}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.selfserviceUi.image) "global" .Values.global) -}}
{{- if .Values.selfserviceUi.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.selfserviceUi.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.selfserviceUi.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.selfserviceUi.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.selfserviceUi.podAffinityPreset "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.selfserviceUi.podAntiAffinityPreset "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.selfserviceUi.nodeAffinityPreset.type "key" .Values.selfserviceUi.nodeAffinityPreset.key "values" .Values.selfserviceUi.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.selfserviceUi.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.selfserviceUi.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.selfserviceUi.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.selfserviceUi.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.selfserviceUi.priorityClassName }}
priorityClassName: {{ .Values.selfserviceUi.priorityClassName | quote }}
{{- end }}
{{- if .Values.selfserviceUi.podSecurityContext.enabled }}
securityContext: {{- omit .Values.selfserviceUi.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.selfserviceUi.initContainers }}
initContainers:
{{- include "common.tplvalues.render" (dict "value" .Values.selfserviceUi.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: pbms-beneficiary-portal-ui
image: {{ include "common.images.image" (dict "imageRoot" .Values.selfserviceUi.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.selfserviceUi.image.pullPolicy }}
{{- if .Values.selfserviceUi.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.selfserviceUi.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.selfserviceUi.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.selfserviceUi.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.selfserviceUi.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.selfserviceUi.command "context" $) }}
{{- end }}
{{- if .Values.selfserviceUi.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.selfserviceUi.args "context" $) }}
{{- end }}
env:
{{- include "pbms.beneficiary-portal.ui.envVars" . | nindent 12 }}
ports:
- name: http
containerPort: {{ .Values.selfserviceUi.containerPort }}
{{- if .Values.selfserviceUi.resources }}
resources: {{- toYaml .Values.selfserviceUi.resources | nindent 12 }}
{{- end }}
{{- if .Values.selfserviceUi.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.selfserviceUi.startupProbe "enabled") "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.selfserviceUi.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.selfserviceUi.livenessProbe "enabled") "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.selfserviceUi.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.selfserviceUi.readinessProbe "enabled") "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.selfserviceUi.extraVolumeMounts }}
volumeMounts: {{- include "common.tplvalues.render" (dict "value" .Values.selfserviceUi.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.selfserviceUi.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.selfserviceUi.sidecars "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.selfserviceUi.extraVolumes }}
volumes: {{- include "common.tplvalues.render" (dict "value" .Values.selfserviceUi.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}
Loading

0 comments on commit dc39a20

Please sign in to comment.