97
97
mountPath : /post-start.sh
98
98
subPath : post-start.sh
99
99
lifecycle :
100
+ preStop :
101
+ exec : # https://blog.laputa.io/graceful-shutdown-in-kubernetes-85f1c8d586da
102
+ # kubeproxy and kubelet both race
103
+ # wait a bit to ensure kubeproxy has removed the iptables rule.
104
+ command : [ "sleep", {{ .Values.st2.st2auth.preStopSleep | default 10 }} ]
100
105
postStart :
101
106
exec :
102
107
command : ["/bin/bash", "/post-start.sh"]
@@ -223,8 +228,10 @@ spec:
223
228
subPath : post-start.sh
224
229
lifecycle :
225
230
preStop :
226
- exec :
227
- command : [ "sleep", {{ .Values.st2.st2api.preStopSleep }} ]
231
+ exec : # https://blog.laputa.io/graceful-shutdown-in-kubernetes-85f1c8d586da
232
+ # kubeproxy and kubelet both race
233
+ # wait a bit to ensure kubeproxy has removed the iptables rule.
234
+ command : [ "sleep", {{ .Values.st2.st2api.preStopSleep | default 10 }} ]
228
235
postStart :
229
236
exec :
230
237
command : ["/bin/bash", "/post-start.sh"]
@@ -310,6 +317,7 @@ spec:
310
317
initContainers :
311
318
{{- include "stackstorm-ha.init-containers-wait-for-db" . | nindent 6 }}
312
319
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
320
+ terminationGracePeriodSeconds : {{ .Values.st2workflowengine.terminationGracePeriodSeconds | default 30 }}
313
321
containers :
314
322
- name : st2stream
315
323
image : ' {{ template "stackstorm-ha.imageRepository" . }}/st2stream:{{ tpl (.Values.st2stream.image.tag | default .Values.image.tag) . }}'
@@ -342,6 +350,11 @@ spec:
342
350
mountPath : /post-start.sh
343
351
subPath : post-start.sh
344
352
lifecycle :
353
+ preStop :
354
+ exec : # https://blog.laputa.io/graceful-shutdown-in-kubernetes-85f1c8d586da
355
+ # kubeproxy and kubelet both race
356
+ # wait a bit to ensure kubeproxy has removed the iptables rule.
357
+ command : [ "sleep", {{ .Values.st2.st2api.preStopSleep | default 10 }} ]
345
358
postStart :
346
359
exec :
347
360
command : ["/bin/bash", "/post-start.sh"]
@@ -410,6 +423,7 @@ spec:
410
423
{{- if .Values.image.pullSecret }}
411
424
- name : {{ .Values.image.pullSecret }}
412
425
{{- end }}
426
+ terminationGracePeriodSeconds : {{ .Values.st2api.terminationGracePeriodSeconds | default 30 }}
413
427
containers :
414
428
- name : st2web
415
429
image : ' {{ template "stackstorm-ha.imageRepository" . }}/st2web:{{ tpl (.Values.st2web.image.tag | default .Values.image.tag) . }}'
@@ -419,6 +433,12 @@ spec:
419
433
{{- end }}
420
434
ports :
421
435
- containerPort : {{ eq (get .Values.st2web.env "ST2WEB_HTTPS" | toString) "1" | ternary 443 80 }}
436
+ lifecycle :
437
+ preStop :
438
+ exec : # https://blog.laputa.io/graceful-shutdown-in-kubernetes-85f1c8d586da
439
+ # kubeproxy and kubelet both race
440
+ # wait a bit to ensure kubeproxy has removed the iptables rule.
441
+ command : [ "sleep", {{ .Values.st2.st2web.preStopSleep | default 10 }} ]
422
442
# Probe to check if app is running. Failure will lead to a pod restart.
423
443
livenessProbe :
424
444
httpGet :
0 commit comments