Provide support for cloudkitty 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: ZhijunWei <wzj334965317@outlook.com>

Change-Id: I8ccfb3c96e642d4b121809236aab0180ac49e3cc
This commit is contained in:
caoyuan 2018-04-13 00:04:56 +08:00
parent b76f40166a
commit 3a34dfa083
6 changed files with 23 additions and 4 deletions

View File

@ -11,6 +11,7 @@ cloudkitty_services:
- "{{ node_config_directory }}/cloudkitty-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/cloudkitty/cloudkitty:/var/lib/kolla/venv/lib/python2.7/site-packages/cloudkitty' if cloudkitty_dev_mode | bool else '' }}"
cloudkitty-processor:
container_name: "cloudkitty_processor"
group: "cloudkitty-processor"
@ -20,6 +21,7 @@ cloudkitty_services:
- "{{ node_config_directory }}/cloudkitty-processor/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/cloudkitty/cloudkitty:/var/lib/kolla/venv/lib/python2.7/site-packages/cloudkitty' if cloudkitty_dev_mode | bool else '' }}"
####################
@ -62,3 +64,11 @@ openstack_cloudkitty_auth: "{{ openstack_auth }}"
# Cloudkitty
####################
cloudkitty_openstack_keystone_default_role: "rating"
####################
# Kolla
####################
cloudkitty_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
cloudkitty_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
cloudkitty_dev_mode: "{{ kolla_dev_mode }}"

View File

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

View File

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

View File

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

View File

@ -104,7 +104,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 }}"
register: check_cloudkitty_containers
when:
- kolla_action != "config"

View File

@ -6,6 +6,9 @@
when: inventory_hostname in groups['cloudkitty-api'] or
inventory_hostname in groups['cloudkitty-processor']
- include: clone.yml
when: cloudkitty_dev_mode | bool
- include: bootstrap.yml
when: inventory_hostname in groups['cloudkitty-api']