helmfile.yaml
10.5 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
environments:
{{ .Environment.Name }}:
missingFileHandler: Debug
values:
- environments/default-values.yaml
{{- if ne .Environment.Name "default" }}
- environments/{{ .Environment.Name }}-values.yaml
{{- end }}
---
releases:
- name: {{ .Values.name }}-moqui-elasticsearch
condition: elasticsearch.enabled
chart: charts/elasticsearch
namespace: {{ .Values.namespace }}
values:
- namePrefix: {{ .Values.name }}-
strategicMergePatches:
- apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: {{ .Values.name }}-moqui
namespace: {{ .Values.namespace }}
spec:
version: {{ .Values.elasticsearch.version }}
- apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
name: {{ .Values.name }}-moqui
namespace: {{ .Values.namespace }}
spec:
count: {{ .Values.elasticsearch.kibana.count }}
version: {{ .Values.elasticsearch.version }}
elasticsearchRef:
name: {{ .Values.name }}-moqui
podTemplate:
spec:
containers:
- name: kibana
resources: {{ .Values.elasticsearch.kibana.resources | toYaml | nindent 20 }}
jsonPatches:
- target:
group: elasticsearch.k8s.elastic.co
version: v1
kind: Elasticsearch
name: {{ .Values.name }}-moqui
namespace: {{ .Values.namespace }}
patch:
- op: replace
path: /spec/nodeSets/0/count
value: {{ .Values.elasticsearch.count }}
- op: add
path: /spec/nodeSets/0/podTemplate
value:
spec:
containers:
- name: elasticsearch
resources: {{ .Values.elasticsearch.resources | toYaml | nindent 22 }}
env: {{ .Values.elasticsearch.env | toYaml | nindent 22 }}
- name: {{ .Values.name }}-moqui-postgresql
condition: postgresql.enabled
chart: charts/postgresql
namespace: {{ .Values.namespace }}
values:
- namePrefix: {{ .Values.name }}-
strategicMergePatches:
- apiVersion: acid.zalan.do/v1
kind: postgresql
metadata:
name: {{ .Values.name }}-moqui-postgresql
namespace: {{ .Values.namespace }}
spec:
teamId: {{ .Values.name }}-moqui
volume:
size: {{ .Values.postgresql.volume.size | quote }}
postgresql:
version: {{ .Values.postgresql.version | quote }}
{{- if .Values | get "postgresql.clone.uid" nil }}
clone:
{{ merge .Values.postgresql.clone ( dict "cluster" ( print .Values.name "-moqui-postgresql" ) ) | toYaml | nindent 12 }}
{{- end }}
- name: {{ .Values.name }}-moqui-app
chart: charts/moqui
namespace: {{ .Values.namespace }}
values:
- namePrefix: {{ .Values.name }}-
jsonPatches:
- target:
group: apps
version: v1
kind: Deployment
name: {{ .Values.name }}-moqui-app
namespace: {{ .Values.namespace }}
patch:
{{- if .Values.postgresql.enabled }}
- op: add
path: /spec/template/spec/volumes/-
value:
name: postgresql-scripts
configMap:
name: {{ .Values.name }}-moqui-postgresql-scripts
defaultMode: 0755
- op: add
path: /spec/template/spec/initContainers/0
value:
name: wait-for-pg
image: {{ .Values.postgresql.images | get "wait-for-pg.name" }}
imagePullPolicy: {{ .Values.postgresql.images | get "wait-for-pg.pullPolicy" }}
command: ["/postgresql-scripts/pg_isready"]
volumeMounts:
- name: postgresql-scripts
mountPath: /postgresql-scripts
env:
- name: POSTGRES_DATABASE
value: moqui
- name: POSTGRES_HOST
value: {{ .Values.name }}-moqui-postgresql
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: moqui.{{ .Values.name }}-moqui-postgresql.credentials.postgresql.acid.zalan.do
key: username
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: moqui.{{ .Values.name }}-moqui-postgresql.credentials.postgresql.acid.zalan.do
key: password
{{- end }}
{{- if .Values.elasticsearch.enabled }}
- op: add
path: /spec/template/spec/volumes/-
value:
name: elasticsearch-scripts
configMap:
name: {{ .Values.name }}-moqui-elasticsearch-scripts
defaultMode: 0755
- op: add
path: /spec/template/spec/initContainers/0
value:
name: wait-for-elasticsearch
image: {{ .Values.app.images | get "moqui-app.name" }}
imagePullPolicy: {{ .Values.app.images | get "moqui-app.pullPolicy" }}
command: ["/elasticsearch-scripts/es_isready"]
volumeMounts:
- name: elasticsearch-scripts
mountPath: /elasticsearch-scripts
env:
- name: elasticsearch_url
value: https://{{ .Values.name }}-moqui-es-http:9200
- name: elasticsearch_user
value: elastic
- name: elasticsearch_password
valueFrom:
secretKeyRef:
name: {{ .Values.name }}-moqui-es-elastic-user
key: elastic
{{- end }}
strategicMergePatches:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.name }}-moqui-log
namespace: {{ .Values.namespace }}
spec:
resources:
requests:
storage: {{ .Values.storage.log.requests }}
{{- if .Values.storage.log.storageClassName }}
storageClassName: {{ .Values.storage.log.storageClassName }}
{{- end }}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.name }}-moqui-txlog
namespace: {{ .Values.namespace }}
spec:
resources:
requests:
storage: {{ .Values.storage.txlog.requests }}
{{- if .Values.storage.txlog.storageClassName }}
storageClassName: {{ .Values.storage.txlog.storageClassName }}
{{- end }}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.name }}-moqui-sessions
namespace: {{ .Values.namespace }}
spec:
resources:
requests:
storage: {{ .Values.storage.sessions.requests }}
{{- if .Values.storage.sessions.storageClassName }}
storageClassName: {{ .Values.storage.sessions.storageClassName }}
{{- end }}
- apiVersion: v1
kind: Service
metadata:
name: {{ .Values.name }}-moqui
namespace: {{ .Values.namespace }}
spec:
selector:
app: {{ .Values.name }}-moqui-app
- apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.name }}-moqui-app
namespace: {{ .Values.namespace }}
labels:
app: {{ .Values.name }}-moqui-app
spec:
selector:
matchLabels:
app: {{ .Values.name }}-moqui-app
template:
metadata:
labels:
app: {{ .Values.name }}-moqui-app
spec:
restartPolicy: Always
securityContext:
runAsUser: 0
runAsGroup: 0
initContainers:
- name: copy-jdbc-drivers
image: {{ .Values.app.images | get "moqui-jdbc-drivers.name" }}
imagePullPolicy: {{ .Values.app.images | get "moqui-jdbc-drivers.pullPolicy" }}
- name: load-moqui
image: {{ .Values.app.images | get "moqui-app.name" }}
imagePullPolicy: {{ .Values.app.images | get "moqui-app.pullPolicy" }}
env:
{{- block "moquideps" . }}
{{- if .Values.elasticsearch.enabled }}
- name: kibana_host
value: {{ .Values.name }}-moqui-kb-http
- name: elasticsearch_url
value: https://{{ .Values.name }}-moqui-es-http:9200
- name: elasticsearch_user
value: elastic
- name: elasticsearch_password
valueFrom:
secretKeyRef:
name: {{ .Values.name }}-moqui-es-elastic-user
key: elastic
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: entity_ds_db_conf
value: postgres
- name: entity_ds_host
value: {{ .Values.name }}-moqui-postgresql
- name: entity_ds_port
value: "5432"
- name: entity_ds_user
valueFrom:
secretKeyRef:
name: moqui.{{ .Values.name }}-moqui-postgresql.credentials.postgresql.acid.zalan.do
key: username
- name: entity_ds_password
valueFrom:
secretKeyRef:
name: moqui.{{ .Values.name }}-moqui-postgresql.credentials.postgresql.acid.zalan.do
key: password
- name: entity_ds_database
value: moqui
- name: entity_ds_schema
value: public
{{- end }}
{{- end }}
containers:
- name: moqui
image: {{ .Values.app.images | get "moqui-app.name" }}
imagePullPolicy: {{ .Values.app.images | get "moqui-app.pullPolicy" }}
resources: {{ .Values.app.resources | toYaml | nindent 20 }}
env:
{{- template "moquideps" . }}