-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgeoserver-deployment.yaml
286 lines (284 loc) · 10.2 KB
/
geoserver-deployment.yaml
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
283
284
285
286
{{- if .Values.georchestra.webapps.geoserver.enabled -}}
{{- $webapp := .Values.georchestra.webapps.geoserver -}}
{{- $database := .Values.database -}}
{{- $database_secret_geodata_name := printf "%s-database-geodata-secret" (include "georchestra.fullname" .) -}}
{{- $database_secret_datafeeder_name := printf "%s-database-datafeeder-secret" (include "georchestra.fullname" .) -}}
{{- $database_secret_gwc_name := printf "%s-database-georchestra-secret" (include "georchestra.fullname" .) -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "georchestra.fullname" . }}-geoserver
labels:
{{- include "georchestra.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ include "georchestra.fullname" . }}-geoserver
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "georchestra.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ include "georchestra.fullname" . }}-geoserver
template:
metadata:
labels:
{{- include "georchestra.selectorLabels" . | nindent 8 }}
org.georchestra.service/name: {{ include "georchestra.fullname" . }}-geoserver
app.kubernetes.io/component: {{ include "georchestra.fullname" . }}-geoserver
{{- if $webapp.jetty_monitoring }}
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "9103"
prometheus.io/scrape: "true"
{{- end }}
spec:
nodeSelector:
"kubernetes.io/os": linux
{{- with .Values.georchestra.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
fsGroup: 999
initContainers:
{{ include "georchestra.bootstrap_georchestra_datadir" . | nindent 6 }}
- name: prepare-geoserver-webapp
image: {{ $webapp.docker_image }}
imagePullPolicy: Always
command:
- /bin/sh
- -c
- cp -r /var/lib/jetty/webapps/geoserver/* /mnt/geoserver_webapp ;
if [ -f /mnt/georchestra_datadir/geoserver/jetty-env.xml ] ; then
cp /mnt/georchestra_datadir/geoserver/jetty-env.xml /mnt/geoserver_webapp/WEB-INF/jetty-env.xml ;
fi ;
if [ -f /mnt/georchestra_datadir/geoserver/web.xml ] ; then
cp /mnt/georchestra_datadir/geoserver/web.xml /mnt/geoserver_webapp/WEB-INF/web.xml ;
fi ;
volumeMounts:
- name: georchestra-datadir
mountPath: /mnt/georchestra_datadir
- name: geoserver-webapp
mountPath: /mnt/geoserver_webapp
- name: fix-permissions-pvc
image: busybox:latest
command: ["sh", "-c", "chown -R 999:999 /mnt/geoserver_datadir /mnt/geoserver_geodata /mnt/geoserver_tiles"]
volumeMounts:
- mountPath: /mnt/geoserver_datadir
name: geoserver-datadir
- mountPath: /mnt/geoserver_geodata
name: geoserver-geodata
- mountPath: /mnt/geoserver_tiles
name: geoserver-tiles
containers:
- name: georchestra-geoserver
image: {{ $webapp.docker_image }}
imagePullPolicy: Always
env:
{{ if $database.builtin }}
- name: GEODATA_PGHOST
value: "{{ .Release.Name }}-database"
- name: GEODATA_PGDATABASE
value: "geodata"
{{ else }}
{{ if $database.geodata.auth.existingSecret }}
{{- $database_secret_geodata_name = $database.geodata.auth.existingSecret -}}
{{ end }}
- name: GEODATA_PGHOST
valueFrom:
secretKeyRef:
name: {{ $database_secret_geodata_name }}
key: host
optional: false
- name: GEODATA_PGDATABASE
valueFrom:
secretKeyRef:
name: {{ $database_secret_geodata_name }}
key: dbname
optional: false
{{ end }}
- name: GEODATA_PGPORT
valueFrom:
secretKeyRef:
name: {{ $database_secret_geodata_name }}
key: port
optional: false
- name: GEODATA_PGUSER
valueFrom:
secretKeyRef:
name: {{ $database_secret_geodata_name }}
key: user
optional: false
- name: GEODATA_PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ $database_secret_geodata_name }}
key: password
optional: false
{{ if $database.builtin }}
- name: DF_PGHOST
value: "{{ .Release.Name }}-database"
- name: DF_PGDATABASE
value: "datafeeder"
{{ else }}
{{ if $database.datafeeder.auth.existingSecret }}
{{- $database_secret_datafeeder_name = $database.datafeeder.auth.existingSecret -}}
{{ end }}
- name: DF_PGHOST
valueFrom:
secretKeyRef:
name: {{ $database_secret_datafeeder_name }}
key: host
optional: false
- name: DF_PGDATABASE
valueFrom:
secretKeyRef:
name: {{ $database_secret_datafeeder_name }}
key: dbname
optional: false
{{ end }}
- name: DF_PGPORT
valueFrom:
secretKeyRef:
name: {{ $database_secret_datafeeder_name }}
key: port
optional: false
- name: DF_PGUSER
valueFrom:
secretKeyRef:
name: {{ $database_secret_datafeeder_name }}
key: user
optional: false
- name: DF_PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ $database_secret_datafeeder_name }}
key: password
optional: false
{{ if $database.builtin }}
- name: GWC_PGHOST
value: "{{ .Release.Name }}-database"
{{- else }}
{{ if $database.auth.existingSecret }}
{{- $database_secret_gwc_name = $database.auth.existingSecret -}}
{{ end }}
- name: GWC_PGHOST
valueFrom:
secretKeyRef:
name: {{ $database_secret_gwc_name }}
key: host
optional: false
{{- end }}
- name: GWC_PGPORT
valueFrom:
secretKeyRef:
name: {{ $database_secret_gwc_name }}
key: port
optional: false
- name: GWC_PGDATABASE
valueFrom:
secretKeyRef:
name: {{ $database_secret_gwc_name }}
key: dbname
optional: false
- name: GWC_PGUSERNAME
valueFrom:
secretKeyRef:
name: {{ $database_secret_gwc_name }}
key: user
optional: false
- name: GWC_PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ $database_secret_gwc_name }}
key: password
optional: false
- name: GEOSERVER_CSRF_WHITELIST
value: {{ .Values.fqdn }}
{{- include "georchestra.database-georchestra-envs" . | nindent 10 }}
{{- if $webapp.extra_environment }}
{{- $webapp.extra_environment | toYaml | nindent 10 }}
{{- end }}
volumeMounts:
- mountPath: /etc/georchestra
name: georchestra-datadir
- mountPath: /mnt/geoserver_geodata
name: geoserver-geodata
- mountPath: /mnt/geoserver_datadir
name: geoserver-datadir
- mountPath: /var/lib/jetty/webapps/geoserver
name: geoserver-webapp
- mountPath: /mnt/geoserver_tiles
name: geoserver-tiles
{{- range $webapp.extra_volumes }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- end }}
ports:
- containerPort: 8080
name: http-proxy
{{- if $webapp.custom_liveness_probe }}
{{ $webapp.custom_liveness_probe | toYaml | nindent 8 }}
{{- else }}
livenessProbe:
httpGet:
path: /geoserver/gwc/service/wmts?SERVICE=WMTS&REQUEST=GetCapabilities
port: 8080
periodSeconds: 10
timeoutSeconds: 5
{{- end }}
startupProbe:
tcpSocket:
port: 8080
failureThreshold: 5
periodSeconds: 40
{{- if $webapp.jetty_monitoring }}
- name: jmx-collectd
image: camptocamp/jmx-collectd:bullseye
volumeMounts:
- mountPath: /collectd-template
name: georchestra-monitoring-cm
ports:
- containerPort: 9103
name: prometheus
command:
- /bin/sh
- -c
- mkdir /etc/collectd/collectd.conf.d/ ;
cat /collectd-template/collectd-jmx-jetty.conf | sed "s/localhost/$(hostname)/g" > /etc/collectd/collectd.conf.d/jmx.conf ;
collectd -f
{{- end }}
volumes:
- name: georchestra-datadir
emptyDir: {}
- name: geoserver-webapp
emptyDir: {}
- name: geoserver-tiles
persistentVolumeClaim:
claimName: {{ include "georchestra.fullname" . }}-geoserver-tiles
- name: geoserver-geodata
persistentVolumeClaim:
claimName: {{ include "georchestra.fullname" . }}-geoserver-geodata
- name: geoserver-datadir
persistentVolumeClaim:
claimName: {{ include "georchestra.fullname" . }}-geoserver-datadir
{{- range $webapp.extra_volumes }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .claimName }}
{{- end }}
{{- if .Values.georchestra.datadir.git.ssh_secret }}
- name: ssh-secret
secret:
secretName: {{ .Values.georchestra.datadir.git.ssh_secret }}
defaultMode: 0400
{{- end }}
{{- if $webapp.jetty_monitoring }}
- name: georchestra-monitoring-cm
configMap:
name: {{ include "georchestra.fullname" . }}-monitoring-cm
{{- end }}
{{- if $webapp.registry_secret }}
imagePullSecrets:
- name: {{ $webapp.registry_secret }}
{{- end }}
{{- end }}