MariaDB: Enable clean shutdown of pods
This PS adds a execstop command to pods, letting them shut down cleanly. Change-Id: Ic5fb1edbff5f380870858c8e5f1b676560e33a8c
This commit is contained in:
parent
d1a1ea6c71
commit
61b4d561bb
24
mariadb/templates/bin/_stop.sh.tpl
Normal file
24
mariadb/templates/bin/_stop.sh.tpl
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
set -xe
|
||||
|
||||
exec mysqladmin \
|
||||
--defaults-file=/etc/mysql/admin_user.cnf \
|
||||
--host=localhost \
|
||||
--connect-timeout 2 \
|
||||
shutdown
|
@ -26,4 +26,6 @@ data:
|
||||
{{ tuple "bin/_readiness.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
start.sh: |
|
||||
{{ tuple "bin/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
stop.sh: |
|
||||
{{ tuple "bin/_stop.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
{{- end }}
|
||||
|
@ -62,8 +62,6 @@ spec:
|
||||
image: {{ .Values.images.tags.mariadb }}
|
||||
imagePullPolicy: {{ .Values.images.pull_policy }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||
command:
|
||||
- /tmp/start.sh
|
||||
env:
|
||||
- name: POD_IP
|
||||
valueFrom:
|
||||
@ -90,6 +88,13 @@ spec:
|
||||
secretKeyRef:
|
||||
name: mariadb-db-root-password
|
||||
key: MYSQL_ROOT_PASSWORD
|
||||
command:
|
||||
- /tmp/start.sh
|
||||
lifecycle:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- /tmp/stop.sh
|
||||
readinessProbe:
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
@ -100,14 +105,18 @@ spec:
|
||||
volumeMounts:
|
||||
- name: mycnfd
|
||||
mountPath: /etc/mysql/conf.d
|
||||
- name: mariadb-bin
|
||||
mountPath: /tmp/readiness.sh
|
||||
subPath: readiness.sh
|
||||
readOnly: true
|
||||
- name: mariadb-bin
|
||||
mountPath: /tmp/start.sh
|
||||
subPath: start.sh
|
||||
readOnly: true
|
||||
- name: mariadb-bin
|
||||
mountPath: /tmp/stop.sh
|
||||
subPath: stop.sh
|
||||
readOnly: true
|
||||
- name: mariadb-bin
|
||||
mountPath: /tmp/readiness.sh
|
||||
subPath: readiness.sh
|
||||
readOnly: true
|
||||
- name: mariadb-etc
|
||||
mountPath: /etc/mysql/my.cnf
|
||||
subPath: my.cnf
|
||||
|
Loading…
x
Reference in New Issue
Block a user