97dc3fc4 by Adam Heath

Initial pass of a basic moqui helm chart, with opensearch and

postgresql.
1 parent 84a682c2
.*.sw?
/build.log
charts/*/charts/*.tgz
......
dependencies:
- name: opensearch
repository: https://opensearch-project.github.io/helm-charts/
version: 2.10.0
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.1.14
digest: sha256:32398ca9a1a4833794b8e26cfdbcf4281951a0fc4caad9951a078bcd0d646b7a
generated: "2023-02-08T12:41:35.591551351-06:00"
apiVersion: v2
name: moqui
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.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: "3.0.0+git"
dependencies:
- name: opensearch
condition: opensearch.enabled
repository: https://opensearch-project.github.io/helm-charts/
version: "2.10.0"
import-values:
- child: .
parent: opensearch
- name: postgresql
condition: postgresql.enabled
repository: https://charts.bitnami.com/bitnami
version: "12.1.14"
import-values:
- child: .
parent: postgresql
{{/*
Expand the name of the chart.
*/}}
{{- define "moqui.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 "moqui.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 "moqui.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "moqui.labels" -}}
helm.sh/chart: {{ include "moqui.chart" . }}
{{ include "moqui.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "moqui.selectorLabels" -}}
app.kubernetes.io/name: {{ include "moqui.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "moqui.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "moqui.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{- define "moqui.opensearch-url" -}}
{{- if .Values.opensearch.enabled -}}
"http://{{- include "opensearch.masterService" .Subcharts.opensearch }}:{{ .Values.opensearch.httpPort }}"
{{- else }}
{{- printf "%s" .Values.opensearch.url }}
{{- end }}
{{- end }}
{{- define "moqui.entity_ds_host" -}}
{{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }}
{{- include "postgresql.primary.svc.headless" .Subcharts.postgresql }}
{{- else -}}
{{ .Values.configMap.entity_ds_host }}
{{- end -}}
{{- end }}
{{- define "moqui.entity_ds_port" -}}
{{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }}
{{- include "postgresql.service.port" .Subcharts.postgresql }}
{{- else -}}
{{ .Values.configMap.entity_ds_port }}
{{- end -}}
{{- end }}
{{- define "moqui.entity_ds_database" -}}
{{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }}
{{- include "postgresql.database" .Subcharts.postgresql }}
{{- else -}}
{{ .Values.configMap.entity_ds_database }}
{{- end -}}
{{- end }}
{{- define "moqui.entity_ds_user" -}}
{{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }}
{{- include "postgresql.username" .Subcharts.postgresql }}
{{- else -}}
{{ .Values.configMap.entity_ds_user }}
{{- end -}}
{{- end }}
{{- define "moqui.entity_ds_password.secret.name" -}}
{{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) -}}
{{- include "postgresql.secretName" .Subcharts.postgresql }}
{{- else -}}
{{ include "moqui.fullname" . }}-dsauth
{{- end -}}
{{- end }}
{{- define "moqui.entity_ds_password.secret.key" -}}
{{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) -}}
password
{{- else -}}
entity_ds_password
{{- end -}}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "moqui.fullname" . }}
labels:
{{- include "moqui.labels" . | nindent 4 }}
data: {{ .Values.configMap | toYaml | nindent 2 }}
{{- if (and (eq .Values.configMap.entity_ds_db_conf "postgres") .Values.postgresql.enabled) }}
{{- else }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "moqui.fullname" . }}-dsauth
labels:
{{- include "moqui.labels" . | nindent 4 }}
stringData:
entity_ds_password: {{ .Values.configMap.entity_ds_password }}
{{- end }}
apiVersion: /v1
kind: Service
metadata:
name: {{ include "moqui.fullname" . }}
labels:
{{- include "moqui.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http-moqui
protocol: http
name: http-moqui
selector:
{{- include "moqui.selectorLabels" . | nindent 4 }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "moqui.fullname" . }}
labels:
{{- include "moqui.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
serviceName: {{ include "moqui.fullname" . }}
selector:
matchLabels:
{{- include "moqui.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "moqui.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "moqui.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
{{- if and (eq .Values.configMap.entity_ds_db_conf "postgres") (.Values.checkDsConnection) }}
- name: postgresql-check-connection
image: "{{ .Values.postgresql.image.registry }}/{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}"
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }}
env:
- name: POSTGRES_HOST
value: {{ include "moqui.entity_ds_host" . }}
- name: POSTGRES_USER
value: {{ include "moqui.entity_ds_user" . }}
- name: POSTGRES_PORT
value: {{ include "moqui.entity_ds_port" . }}
command:
- bash
- -cx
- |-
until pg_isready -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -p ${POSTGRES_PORT}; do
sleep 5
done
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "moqui.fullname" . }}
env:
- name: entity_ds_db_conf
value: 'postgres'
- name: entity_ds_database
value: {{ include "moqui.entity_ds_database" . }}
- name: entity_ds_host
value: {{ include "moqui.entity_ds_host" . }}
- name: entity_ds_port
value: {{ include "moqui.entity_ds_port" . }}
- name: entity_ds_user
value: {{ include "moqui.entity_ds_user" . }}
- name: entity_ds_password
valueFrom:
secretKeyRef:
name: {{ include "moqui.entity_ds_password.secret.name" . }}
key: {{ include "moqui.entity_ds_password.secret.key" . }}
optional: false
- name: elasticsearch_url
value: {{ include "moqui.opensearch-url" . }}
ports:
- name: http-moqui
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http-moqui
readinessProbe:
httpGet:
path: /
port: http-moqui
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
itolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.virtualService.enabled }}
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: {{ include "moqui.fullname" }}
labels:
{{- include "moqui.labels" . | nindent 4 }}
spec:
gateways: {{ .Values.virtualService.gateways | toYaml | nindent 4 }}
hosts: {{ .Values.virtualService.hosts | toYaml | nindent 4 }}
http:
- match: {{ .Values.virtualService.match | toYaml | nindent 8 }}
route:
- destination:
port:
number: 8080
host: {{ include "moqui.fullname" }}
{{- end }}
imagePullSecrets: {}
image:
pullPolicy: null
repository: moqui/moquidemo
tag: null
configMap:
entity_ds_db_conf: "postgres"
entity_ds_database: "moqui"
entity_ds_host: external-postgres
entity_ds_port: 5432
entity_ds_user: "moqui"
entity_ds_password: "iuqom"
checkDsConnection:
enabled: true
postgresql:
enabled: true
auth:
database: moqui
username: moqui
password: iuqom
opensearch:
enabled: true
clusterName: foo-opensearch
url: "http://127.0.0.1:9200"
singleNode: true
masterService: ""
service:
type: ClusterIP
port: 8080
ingress:
enabled: false
virtualService:
enabled: false
gateways:
- istio-system/ingress-gateway
hosts:
- moqui.local
match:
- uri:
prefix: "/"
serviceAccount:
create: false
name: default
podSecurityContext: {}
securityContext: {}
replicaCount: 1
podAnnotations: {}
resources: {}
nodeSelector: {}
affinity: {}
tolerations: {}
autoscaling:
enabled: false