Add Mariadb service

There's a job that bootstraps the database and exits. This job
creates the database in a hostPath (we need to fix this later
to a persistent volume). The Pod restarts takes care of
the wait for the database to be created. If necessary we can
add code to wait for the job to finish before starting the pod

Implements blueprint openstack-services
Change-Id: Ib1ef158173d9c87d8355268f26ddbc033630cb24
This commit is contained in:
Davanum Srinivas 2016-05-11 07:51:54 -04:00
parent 358f3cd9c7
commit f6fcad8de3
3 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,35 @@
apiVersion: batch/v1
kind: Job
spec:
template:
metadata:
name: mariadb-generate
spec:
hostNetwork: True
containers:
- image: "{{ mariadb_image_full }}"
name: mariadb
volumeMounts:
- mountPath: {{ container_config_directory }}
name: mariadb-config
- mountPath: /var/lib/mysql
name: mariadb-persistent-storage
- mountPath: /var/log/kolla/
name: kolla-logs
env:
- name: KOLLA_BOOTSTRAP
value: ""
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
volumes:
- name: mariadb-config
configMap:
name: mariadb-configmap
- name: mariadb-persistent-storage
hostPath:
path: /var/lib/kolla/mariadb
- name: kolla-logs
emptyDir: {}
restartPolicy: OnFailure
metadata:
name: mariadb-bootstrap

View File

@ -0,0 +1,28 @@
apiVersion: v1
kind: Pod
spec:
hostNetwork: True
containers:
- image: "{{ mariadb_image_full }}"
name: mariadb
volumeMounts:
- mountPath: {{ container_config_directory }}
name: mariadb-config
- mountPath: /var/lib/mysql
name: mariadb-persistent-storage
- mountPath: /var/log/kolla/
name: kolla-logs
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
volumes:
- name: mariadb-config
configMap:
name: mariadb-configmap
- name: mariadb-persistent-storage
hostPath:
path: /var/lib/kolla/mariadb
- name: kolla-logs
emptyDir: {}
metadata:
name: mariadb

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Service
spec:
ports:
- port: {{ mariadb_port }}
selector:
name: mariadb
metadata:
name: mariadb