Adding Mariadb shutdown command to POD delete event
This PS adds mysqladmin shutdown command to gracefully shutdown Mariadb. POD's lifecycle PreStop hook is used for this purpose. It also switches to PetSet for mariadb pod. Partially-implements: blueprint deployments Partially-implements: blueprint api-termination Change-Id: I582b35fe2cfd28ee23fbd9012d9420083291feb3
This commit is contained in:
parent
5800b04729
commit
257d68ee6b
|
@ -1,18 +1,24 @@
|
||||||
{%- set resourceName = kolla_kubernetes.cli.args.service_name %}
|
{%- set resourceName = kolla_kubernetes.cli.args.service_name %}
|
||||||
apiVersion: v1
|
apiVersion: apps/v1alpha1
|
||||||
kind: ReplicationController
|
kind: PetSet
|
||||||
spec:
|
spec:
|
||||||
|
serviceName: "mariadb"
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
|
||||||
service: mariadb
|
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
service: mariadb
|
service: mariadb
|
||||||
|
annotations:
|
||||||
|
pod.alpha.kubernetes.io/initialized: "true"
|
||||||
spec:
|
spec:
|
||||||
|
terminationGracePeriodSeconds: 120
|
||||||
containers:
|
containers:
|
||||||
- image: "{{ mariadb_image_full }}"
|
- image: "{{ mariadb_image_full }}"
|
||||||
name: mariadb
|
name: mariadb
|
||||||
|
lifecycle:
|
||||||
|
preStop:
|
||||||
|
exec:
|
||||||
|
command: ["mysqladmin -u {{ database_user }} -p$DATABASE_PASSWORD shutdown"]
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: {{ container_config_directory }}
|
- mountPath: {{ container_config_directory }}
|
||||||
name: mariadb-config
|
name: mariadb-config
|
||||||
|
@ -25,6 +31,11 @@ spec:
|
||||||
value: ""
|
value: ""
|
||||||
- name: KOLLA_CONFIG_STRATEGY
|
- name: KOLLA_CONFIG_STRATEGY
|
||||||
value: {{ config_strategy }}
|
value: {{ config_strategy }}
|
||||||
|
- name: DATABASE_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: database-password
|
||||||
|
key: password
|
||||||
ports:
|
ports:
|
||||||
- containerPort: {{ mariadb_port }}
|
- containerPort: {{ mariadb_port }}
|
||||||
name: mariadb
|
name: mariadb
|
||||||
|
|
Loading…
Reference in New Issue