Skip to content

Commit

Permalink
Merge pull request #71 from lalithkota/main
Browse files Browse the repository at this point in the history
Added Mimoto Deployment Charts
  • Loading branch information
lalithkota authored Sep 18, 2024
2 parents 22441dc + 4565bec commit 436409c
Show file tree
Hide file tree
Showing 19 changed files with 1,039 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charts/mimoto/.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/mimoto/.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/
22 changes: 22 additions & 0 deletions charts/mimoto/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v2
name: mimoto
description: A Helm chart for Mimoto (Inji Backend)
type: application
version: 0.13.1
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.x.x
- name: artifactory
version: 12.0.2
condition: artifactory.enabled
keywords:
- mosip
- mimoto
- kernel
maintainers:
- email: [email protected]
name: OpenG2P
icon: https://openg2p.github.io/openg2p-helm/openg2p-logo.png
annotations:
catalog.cattle.io/display-name: "Mimoto"
3 changes: 3 additions & 0 deletions charts/mimoto/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Mimoto

Helm chart for installing MOSIP's Mimoto module (Inji Backend) along with required dependencies.
1 change: 1 addition & 0 deletions charts/mimoto/app-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mimoto Installation.
1 change: 1 addition & 0 deletions charts/mimoto/charts/artifactory
54 changes: 54 additions & 0 deletions charts/mimoto/questions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
questions:
- variable: hostname
description: Hostname under which Mimoto should be accessible
type: string
label: Mimoto Hostname

- variable: global.keycloakBaseUrl
description: Required for API auth validation.
type: string
label: Keycloak Base URL

- variable: springConfig.profile
type: string
label: Spring Config Profile

- variable: springConfig.names
type: string
label: Spring Config Names

- variable: springConfig.gitRepo.enabled
description: Enables download of configs from Git repo.
type: boolean
label: Spring Config Git Enabled
show_subquestions_if: true
subquestions:
- variable: springConfig.gitRepo.repoUrl
description: |-
Repo Url for remote Git repo containing configs.
This url should include username password if required.
type: string
label: Spring Config Git Repo Url

- variable: springConfig.gitRepo.branch
description: Branch of remote Git repo containing configs.
type: string
label: Spring Config Git Repo Branch

- variable: springConfig.rawConfig
description: |-
If git-based config is disabled, the complete application.properties can be
directly supplied here.
type: yamlfile
label: Spring Config application properties.
show_if: "springConfig.gitRepo.enabled=false"

- variable: oidcClientKeySecretName
description: Name of the secret that contains the p12 file holding OIDC Client Keys
type: string
label: OIDC Client Keys Secret Name

- variable: envVars.mosip_oidc_p12_password
description: Password for the P12 file holding OIDC Client Keys
type: string
label: OIDC Client Keys P12 Password
101 changes: 101 additions & 0 deletions charts/mimoto/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{{/*
Return the proper image name
*/}}
{{- define "mimoto.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}

{{/*
Return the proper image name (for the init container volume-permissions image)
*/}}
{{- define "mimoto.volumePermissions.image" -}}
{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}}
{{- end -}}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "mimoto.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "mimoto.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Compile all warnings into a single message.
*/}}
{{- define "mimoto.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "mimoto.validateValues.foo" .) -}}
{{- $messages := append $messages (include "mimoto.validateValues.bar" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}

{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message -}}
{{- end -}}
{{- end -}}

{{/*
Return podAnnotations
*/}}
{{- define "mimoto.podAnnotations" -}}
{{- if .Values.podAnnotations }}
{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }}
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }}
{{- end }}
{{- end -}}

{{/*
Render Env values section
*/}}
{{- define "mimoto.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 "mimoto.envVars" -}}
{{- $envVars := merge (deepCopy .Values.envVars) (deepCopy .Values.envVarsFrom) (.Values.springConfig.gitRepo.enabled | ternary (deepCopy .Values.springConfig.gitRepo.envVars) dict) -}}
{{- include "mimoto.baseEnvVars" (dict "envVars" $envVars "context" $) }}
{{- end -}}

{{/*
Return command
*/}}
{{- define "mimoto.commandBase" -}}
{{- if or .command .args }}
{{- if .command }}
command: {{- include "common.tplvalues.render" (dict "value" .command "context" .context) }}
{{- end }}
{{- if .args }}
args: {{- include "common.tplvalues.render" (dict "value" .args "context" .context) }}
{{- end }}
{{- else if .startUpCommand }}
command: ["/startup.sh"]
args: []
{{- end }}
{{- end -}}

{{- define "mimoto.command" -}}
{{- include "mimoto.commandBase" (dict "command" .Values.command "args" .Values.args "startUpCommand" .Values.startUpCommand "context" $) }}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/mimoto/templates/configmap-spring-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.springConfig.rawConfig }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}-spring-config
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 }}
data:
application.properties: |-
{{- include "common.tplvalues.render" (dict "value" .Values.springConfig.rawConfig "context" $) | nindent 4 }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/mimoto/templates/configmap-startup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if and .Values.startUpCommand (not (or .Values.command .Values.args)) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}-startup
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 }}
data:
startup.sh: |-
{{- include "common.tplvalues.render" (dict "value" .Values.startUpCommand "context" $) | nindent 4 }}
{{- end }}
123 changes: 123 additions & 0 deletions charts/mimoto/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "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 or .Values.podAnnotations .Values.metrics.enabled }}
annotations: {{- include "mimoto.podAnnotations" . | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.podLabels "context" $) | nindent 8 }}
spec:
serviceAccountName: {{ template "mimoto.serviceAccountName" . }}
{{- include "mimoto.imagePullSecrets" . | nindent 6 }}
{{- 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: mimoto
image: {{ template "mimoto.image" . }}
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 }}
{{- include "mimoto.command" . | nindent 10 }}
env:
{{- include "mimoto.envVars" . | nindent 12 }}
ports:
- name: spring-service
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 }}
volumeMounts:
{{- if and .Values.startUpCommand (not (or .Values.command .Values.args)) }}
- name: startup-command
mountPath: /startup.sh
subPath: startup.sh
{{- end }}
{{- if and .Values.springConfig.rawConfig (not .Values.springConfig.gitRepo.enabled) }}
- name: spring-config
mountPath: {{ include "common.tplvalues.render" (dict "value" .Values.springConfig.rawConfigMountPath "context" $) }}
subPath: application.properties
{{- end }}
- name: oidc-client-keys
mountPath: {{ include "common.tplvalues.render" (dict "value" .Values.envVars.mosip_oidc_p12_path "context" $) }}{{ include "common.tplvalues.render" (dict "value" .Values.envVars.mosip_oidc_p12_filename "context" $) }}
subPath: {{ include "common.tplvalues.render" (dict "value" .Values.envVars.mosip_oidc_p12_filename "context" $) }}
{{- if .Values.extraVolumeMounts }}
{{- 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 }}
volumes:
{{- if and .Values.startUpCommand (not (or .Values.command .Values.args)) }}
- name: startup-command
configMap:
name: {{ template "common.names.fullname" . }}-startup
defaultMode: 0755
{{- end }}
{{- if and .Values.springConfig.rawConfig (not .Values.springConfig.gitRepo.enabled) }}
- name: spring-config
configMap:
name: {{ template "common.names.fullname" . }}-spring-config
{{- end }}
- name: oidc-client-keys
secret:
name: {{ include "common.tplvalues.render" (dict "value" .Values.oidcClientKeySecretName "context" $) }}
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/mimoto/templates/extra-list.yaml
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 }}
Loading

0 comments on commit 436409c

Please sign in to comment.