Provide support for freezer dev mode in kolla

Add a possibility to mount sources as volumes to containers,
in "more than documentation" way. That will let us to use kolla
as a replacement for devstack.

Partially implements: blueprint mount-sources
Co-Authored-By: wu.chunyang <wu.chunyang@99cloud.net>

Change-Id: Ia3112a0d297ac777e1f25d3ddecced7746ca6418
This commit is contained in:
caoyuan 2018-04-13 08:48:53 +08:00
parent d03b6daf77
commit e50d18e4fb
6 changed files with 29 additions and 3 deletions

View File

@ -12,6 +12,7 @@ freezer_services:
- "/etc/localtime:/etc/localtime:ro"
- "freezer:/var/lib/freezer/"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/freezer-api/freezer_api:/var/lib/kolla/venv/lib/python2.7/site-packages/freezer_api' if freezer_dev_mode | bool else '' }}"
dimensions: "{{ freezer_api_dimensions }}"
freezer-scheduler:
container_name: freezer_scheduler
@ -23,6 +24,7 @@ freezer_services:
- "/etc/localtime:/etc/localtime:ro"
- "freezer:/var/lib/freezer/"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/freezer/freezer:/var/lib/kolla/venv/lib/python2.7/site-packages/freezer' if freezer_dev_mode | bool else '' }}"
dimensions: "{{ freezer_scheduler_dimensions }}"
@ -55,3 +57,12 @@ freezer_logging_debug: "{{ openstack_logging_debug }}"
freezer_keystone_user: "freezer"
openstack_freezer_auth: "{{ openstack_auth }}"
####################
# Kolla
####################
freezer_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
freezer_api_git_repository: "{{ kolla_dev_repos_git }}/freezer-api"
freezer_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
freezer_dev_mode: "{{ kolla_dev_mode }}"

View File

@ -39,7 +39,7 @@
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
volumes: "{{ service.volumes | reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"

View File

@ -15,6 +15,6 @@
BOOTSTRAP:
name: "bootstrap_freezer"
restart_policy: "never"
volumes: "{{ freezer_api.volumes }}"
volumes: "{{ freezer_api.volumes | reject('equalto', '') | list }}"
run_once: True
delegate_to: "{{ groups[freezer_api.group][0] }}"

View File

@ -0,0 +1,12 @@
---
- name: Cloning freezer source repository for development
git:
repo: "{{ freezer_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}"
update: "{{ freezer_dev_repos_pull }}"
- name: Cloning freezer-api source repository for development
git:
repo: "{{ freezer_api_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/freezer-api"
update: "{{ freezer_dev_repos_pull }}"

View File

@ -101,7 +101,7 @@
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes }}"
volumes: "{{ item.value.volumes | reject('equalto', '') | list }}"
dimensions: "{{ item.value.dimensions }}"
register: check_freezer_containers
when:

View File

@ -9,5 +9,8 @@
- include_tasks: bootstrap_service.yml
when: inventory_hostname in groups['freezer-api']
- include_tasks: clone.yml
when: freezer_dev_mode | bool
- name: Flush handlers
meta: flush_handlers