Provide support for solum 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

Change-Id: If241033d8c94c13f980fc3cc322f198187d64a21
This commit is contained in:
caoyuan 2018-01-18 17:10:59 +08:00
parent b76f40166a
commit a71e90584a
6 changed files with 27 additions and 6 deletions

View File

@ -11,6 +11,7 @@ solum_services:
- "{{ node_config_directory }}/solum-api/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/solum-api/:{{ 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 ~ '/solum/solum:/var/lib/kolla/venv/lib/python2.7/site-packages/solum' if solum_dev_mode | bool else '' }}"
solum-worker: solum-worker:
container_name: solum_worker container_name: solum_worker
group: solum-worker group: solum-worker
@ -20,6 +21,7 @@ solum_services:
- "{{ node_config_directory }}/solum-worker/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/solum-worker/:{{ 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 ~ '/solum/solum:/var/lib/kolla/venv/lib/python2.7/site-packages/solum' if solum_dev_mode | bool else '' }}"
solum-deployer: solum-deployer:
container_name: solum_deployer container_name: solum_deployer
group: solum-deployer group: solum-deployer
@ -29,6 +31,7 @@ solum_services:
- "{{ node_config_directory }}/solum-deployer/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/solum-deployer/:{{ 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 ~ '/solum/solum:/var/lib/kolla/venv/lib/python2.7/site-packages/solum' if solum_dev_mode | bool else '' }}"
solum-conductor: solum-conductor:
container_name: solum_conductor container_name: solum_conductor
group: solum-conductor group: solum-conductor
@ -38,6 +41,7 @@ solum_services:
- "{{ node_config_directory }}/solum-conductor/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/solum-conductor/:{{ 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 ~ '/solum/solum:/var/lib/kolla/venv/lib/python2.7/site-packages/solum' if solum_dev_mode | bool else '' }}"
#################### ####################
@ -87,3 +91,11 @@ solum_logging_debug: "{{ openstack_logging_debug }}"
solum_keystone_user: "solum" solum_keystone_user: "solum"
openstack_solum_auth: "{{ openstack_auth }}" openstack_solum_auth: "{{ openstack_auth }}"
####################
# Kolla
####################
solum_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
solum_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
solum_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:
- kolla_action != "config" - kolla_action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
@ -34,7 +34,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:
- kolla_action != "config" - kolla_action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
@ -56,7 +56,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:
- kolla_action != "config" - kolla_action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
@ -78,7 +78,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:
- kolla_action != "config" - kolla_action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]

View File

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

View File

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

View File

@ -60,7 +60,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_solum_containers register: check_solum_containers
when: when:
- kolla_action != "config" - kolla_action != "config"

View File

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