dev mode: Add support for magnum

Provide support fot kolla dev mode in Magnum. When
'kolla_dev_mode' or 'magnum_dev_mode' variables are
enabled, source code of Magnum project is cloned
and bindmounted.

Partially implements: blueprint mount-sources

Change-Id: Id479bf4dc77ee4a2367c9c7d8f0f00de761b8c85
This commit is contained in:
Michal Rostecki 2018-01-04 12:14:56 +01:00
parent e4c7b50320
commit 8533fc584b
6 changed files with 23 additions and 4 deletions

View File

@ -12,6 +12,7 @@ magnum_services:
volumes:
- "{{ node_config_directory }}/magnum-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "{{ kolla_dev_repos_directory ~ '/magnum/magnum:/var/lib/kolla/venv/lib/python2.7/site-packages/magnum' if magnum_dev_mode | bool else '' }}"
- "kolla_logs:/var/log/kolla/"
magnum-conductor:
container_name: magnum_conductor
@ -23,6 +24,7 @@ magnum_services:
- "{{ node_config_directory }}/magnum-conductor/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "magnum:/var/lib/magnum/"
- "{{ kolla_dev_repos_directory ~ '/magnum/magnum:/var/lib/kolla/venv/lib/python2.7/site-packages/magnum' if magnum_dev_mode | bool else '' }}"
- "kolla_logs:/var/log/kolla/"
@ -69,3 +71,11 @@ magnum_trustee_domain_admin: "magnum_trustee_domain_admin"
magnum_trustee_domain: "magnum"
openstack_magnum_auth: "{{ openstack_auth }}"
####################
# Kolla
####################
magnum_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
magnum_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
magnum_dev_mode: "{{ kolla_dev_mode }}"

View File

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

View File

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

View File

@ -0,0 +1,6 @@
---
- name: Cloning magnum source repository for development
git:
repo: "{{ magnum_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}"
update: "{{ magnum_dev_repos_pull }}"

View File

@ -67,7 +67,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 }}"
environment: "{{ item.value.environment }}"
register: check_magnum_containers
when:

View File

@ -6,6 +6,9 @@
when: inventory_hostname in groups['magnum-api'] or
inventory_hostname in groups['magnum-conductor']
- include: clone.yml
when: magnum_dev_mode | bool
- include: bootstrap.yml
when: inventory_hostname in groups['magnum-api']