dev mode: Add support for aodh

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

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

Change-Id: I1235013ab2ff887c4311126cbff7367775f66347
This commit is contained in:
caoyuan 2018-04-12 23:07:23 +08:00
parent ed9854248f
commit 0025aac92e
6 changed files with 27 additions and 6 deletions

View File

@ -12,6 +12,7 @@ aodh_services:
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
- "aodh:/var/lib/aodh/" - "aodh:/var/lib/aodh/"
- "kolla_logs:/var/log/kolla/" - "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/aodh/aodh:/var/lib/kolla/venv/lib/python2.7/site-packages/aodh' if aodh_dev_mode | bool else '' }}"
aodh-evaluator: aodh-evaluator:
container_name: aodh_evaluator container_name: aodh_evaluator
group: aodh-evaluator group: aodh-evaluator
@ -21,6 +22,7 @@ aodh_services:
- "{{ node_config_directory }}/aodh-evaluator/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/aodh-evaluator/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/" - "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/aodh/aodh:/var/lib/kolla/venv/lib/python2.7/site-packages/aodh' if aodh_dev_mode | bool else '' }}"
aodh-listener: aodh-listener:
container_name: aodh_listener container_name: aodh_listener
group: aodh-listener group: aodh-listener
@ -30,6 +32,7 @@ aodh_services:
- "{{ node_config_directory }}/aodh-listener/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/aodh-listener/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/" - "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/aodh/aodh:/var/lib/kolla/venv/lib/python2.7/site-packages/aodh' if aodh_dev_mode | bool else '' }}"
aodh-notifier: aodh-notifier:
container_name: aodh_notifier container_name: aodh_notifier
group: aodh-notifier group: aodh-notifier
@ -39,6 +42,7 @@ aodh_services:
- "{{ node_config_directory }}/aodh-notifier/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/aodh-notifier/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/" - "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/aodh/aodh:/var/lib/kolla/venv/lib/python2.7/site-packages/aodh' if aodh_dev_mode | bool else '' }}"
#################### ####################
@ -83,3 +87,11 @@ aodh_logging_debug: "{{ openstack_logging_debug }}"
aodh_keystone_user: "aodh" aodh_keystone_user: "aodh"
openstack_aodh_auth: "{{ openstack_auth }}" openstack_aodh_auth: "{{ openstack_auth }}"
####################
# Kolla
####################
aodh_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
aodh_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
aodh_dev_mode: "{{ kolla_dev_mode }}"

View File

@ -12,7 +12,7 @@
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}" name: "{{ service.container_name }}"
image: "{{ service.image }}" image: "{{ service.image }}"
volumes: "{{ service.volumes }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when: when:
- action != "config" - action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
@ -36,7 +36,7 @@
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}" name: "{{ service.container_name }}"
image: "{{ service.image }}" image: "{{ service.image }}"
volumes: "{{ service.volumes }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when: when:
- action != "config" - action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
@ -59,7 +59,7 @@
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}" name: "{{ service.container_name }}"
image: "{{ service.image }}" image: "{{ service.image }}"
volumes: "{{ service.volumes }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when: when:
- action != "config" - action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
@ -82,7 +82,7 @@
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}" name: "{{ service.container_name }}"
image: "{{ service.image }}" image: "{{ service.image }}"
volumes: "{{ service.volumes }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when: when:
- action != "config" - action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]

View File

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

View File

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

View File

@ -109,7 +109,7 @@
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}" name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}" image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes }}" volumes: "{{ item.value.volumes|reject('equalto', '')|list }}"
register: check_aodh_containers register: check_aodh_containers
when: when:
- action != "config" - action != "config"

View File

@ -8,6 +8,9 @@
inventory_hostname in groups['aodh-listener'] or inventory_hostname in groups['aodh-listener'] or
inventory_hostname in groups['aodh-notifier'] inventory_hostname in groups['aodh-notifier']
- include: clone.yml
when: aodh_dev_mode | bool
- include: bootstrap.yml - include: bootstrap.yml
when: inventory_hostname in groups['aodh-api'] when: inventory_hostname in groups['aodh-api']