moqui.yaml
6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
apiVersion: apps/v1
kind: {{ .Values.kind }}
metadata:
name: {{ include "moqui.fullname" . }}
labels:
{{- include "moqui.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- if (eq "StatefulSet" .Values.kind) }}
serviceName: {{ include "moqui.fullname" . }}
{{- end }}
selector:
matchLabels:
{{- include "moqui.selectorLabels" . | nindent 6 }}
{{- if (eq "StatefulSet" .Values.kind) }}
volumeClaimTemplates:
{{- include "moqui.storage-volumeClaimTemplate" (list . "db") | nindent 4 }}
{{- include "moqui.storage-volumeClaimTemplate" (list . "log") | nindent 4 }}
{{- include "moqui.storage-volumeClaimTemplate" (list . "sessions") | nindent 4 }}
{{- include "moqui.storage-volumeClaimTemplate" (list . "txlog") | nindent 4 }}
{{- end }}
template:
metadata:
{{- $checksums := (dict
"checksum/config-map" (include (print .Template.BasePath "/config-map.yaml") . | sha256sum | trunc 63)
"checksum/secret" (include (print .Template.BasePath "/secret.yaml") . | sha256sum | trunc 63)
) }}
annotations: {{ merge (dict) .Values.podAnnotations $checksums | toYaml | nindent 8 }}
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 }}
volumes:
- name: runtime-lib
emptyDir: {}
- name: disable-elasticsearch
emptyDir: {}
{{- include "moqui.storage-pvc-volume" (list . "db") | nindent 8 }}
{{- include "moqui.storage-pvc-volume" (list . "log") | nindent 8 }}
{{- include "moqui.storage-pvc-volume" (list . "sessions") | nindent 8 }}
{{- include "moqui.storage-pvc-volume" (list . "txlog") | nindent 8 }}
initContainers:
{{- if (eq .Values.configMap.entity_ds_db_conf "postgres") }}
{{- if .Values.postgresql.jdbcImage.enabled }}
- name: postgresql-copy-jdbc
{{ include "moqui.image-helper" .Values.postgresql.jdbcImage | nindent 10 }}
command:
- bash
- -cx
- cp -a /usr/share/java/*.jar /tmp/runtime-lib
volumeMounts:
- mountPath: /tmp/runtime-lib
name: runtime-lib
{{- end }}
{{- if (.Values.checkDsConnection.enabled) }}
- name: postgresql-check-connection
{{ include "moqui.image-helper" (coalesce .Values.postgresql.image .Values.checkImage) | nindent 10 }}
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" . | quote }}
command:
- bash
- -cx
- |-
until pg_isready -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -p ${POSTGRES_PORT}; do
sleep 5
done
{{- end }}
{{- end }}
{{- define "moqui-container-pod" }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{ include "moqui.image-helper" .Values.image | nindent 10 }}
command: ["java", "-server", "-XX:-OmitStackTraceInFastThrow", "-cp", ".", "MoquiStart"]
envFrom:
- configMapRef:
name: {{ include "moqui.fullname" . }}
- secretRef:
name: {{ include "moqui.fullname" . }}-opensearch
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" . | quote }}
- 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" . }}
{{- include "moqui.extraEnvs" . | nindent 12 }}
volumeMounts:
- mountPath: /opt/moqui/runtime/lib
name: runtime-lib
- mountPath: /opt/moqui/runtime/elasticsearch
name: disable-elasticsearch
{{- include "moqui.storage-mount" (list . "db" "/opt/moqui/runtime/db") | nindent 12 }}
{{- include "moqui.storage-mount" (list . "log" "/opt/moqui/runtime/log") | nindent 12 }}
{{- include "moqui.storage-mount" (list . "sessions" "/opt/moqui/runtime/sessions") | nindent 12 }}
{{- include "moqui.storage-mount" (list . "txlog" "/opt/moqui/runtime/txlog") | nindent 12 }}
{{- end }}
- name: load
{{ include "moqui-container-pod" . }}
args:
- "load"
- -types=$(moqui_load_types)
- -check-empty-types=$(entity_empty_db_load)
containers:
- name: {{ .Chart.Name }}
{{ include "moqui-container-pod" . }}
args: ["run"]
ports:
- name: http-moqui
containerPort: 8080
protocol: TCP
{{ include "moqui.health-probe" (list "livenessProbe" .Values.health.liveness) | nindent 10 }}
{{ include "moqui.health-probe" (list "readinessProbe" .Values.health.readiness) | nindent 10 }}
{{ include "moqui.health-probe" (list "startupProbe" .Values.health.startup) | nindent 10 }}
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 }}