From 36b93dd6e234293a9d30a45cf4c74540182b01d1 Mon Sep 17 00:00:00 2001 From: "wu.chunyang" Date: Sun, 14 Jun 2020 23:42:09 +0800 Subject: [PATCH] Add support of octavia dev mod Similarly to other OpenStack services octavia should support kolla dev mod for debugging. Change-Id: I81b79dc0a4c5e40a67af7120a4109dfe11098a97 --- ansible/roles/octavia/defaults/main.yml | 12 ++++++++++++ ansible/roles/octavia/handlers/main.yml | 8 ++++---- ansible/roles/octavia/tasks/bootstrap_service.yml | 2 +- ansible/roles/octavia/tasks/clone.yml | 8 ++++++++ ansible/roles/octavia/tasks/deploy.yml | 3 +++ ...add-support-octavia-dev-mod-c785e7be398c7c8e.yaml | 4 ++++ 6 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 ansible/roles/octavia/tasks/clone.yml create mode 100644 releasenotes/notes/add-support-octavia-dev-mod-c785e7be398c7c8e.yaml diff --git a/ansible/roles/octavia/defaults/main.yml b/ansible/roles/octavia/defaults/main.yml index 0e03c02665..1a13e0ea3a 100644 --- a/ansible/roles/octavia/defaults/main.yml +++ b/ansible/roles/octavia/defaults/main.yml @@ -90,21 +90,25 @@ octavia_api_default_volumes: - "/etc/localtime:/etc/localtime:ro" - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/octavia/octavia:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/octavia' }}" octavia_health_manager_default_volumes: - "{{ node_config_directory }}/octavia-health-manager/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/octavia/octavia:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/octavia' if octavia_dev_mode | bool else '' }}" octavia_housekeeping_default_volumes: - "{{ node_config_directory }}/octavia-housekeeping/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/octavia/octavia:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/octavia' if octavia_dev_mode | bool else '' }}" octavia_worker_default_volumes: - "{{ node_config_directory }}/octavia-worker/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/octavia/octavia:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/octavia' if octavia_dev_mode | bool else '' }}" octavia_extra_volumes: "{{ default_extra_volumes }}" octavia_api_extra_volumes: "{{ octavia_extra_volumes }}" @@ -146,3 +150,11 @@ octavia_ks_users: user: "{{ octavia_keystone_user }}" password: "{{ octavia_keystone_password }}" role: "admin" + +#################### +# Kolla +#################### +octavia_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}" +octavia_dev_repos_pull: "{{ kolla_dev_repos_pull }}" +octavia_dev_mode: "{{ kolla_dev_mode }}" +octavia_source_version: "{{ kolla_source_version }}" diff --git a/ansible/roles/octavia/handlers/main.yml b/ansible/roles/octavia/handlers/main.yml index 4cec448f74..1f856365b5 100644 --- a/ansible/roles/octavia/handlers/main.yml +++ b/ansible/roles/octavia/handlers/main.yml @@ -9,7 +9,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" @@ -24,7 +24,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" @@ -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" @@ -54,7 +54,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" diff --git a/ansible/roles/octavia/tasks/bootstrap_service.yml b/ansible/roles/octavia/tasks/bootstrap_service.yml index af6d2fd6be..ce5ce74635 100644 --- a/ansible/roles/octavia/tasks/bootstrap_service.yml +++ b/ansible/roles/octavia/tasks/bootstrap_service.yml @@ -15,6 +15,6 @@ BOOTSTRAP: name: "bootstrap_octavia" restart_policy: no - volumes: "{{ octavia_api.volumes }}" + volumes: "{{ octavia_api.volumes | reject('equalto', '') | list }}" run_once: True delegate_to: "{{ groups[octavia_api.group][0] }}" diff --git a/ansible/roles/octavia/tasks/clone.yml b/ansible/roles/octavia/tasks/clone.yml new file mode 100644 index 0000000000..80b9342ffc --- /dev/null +++ b/ansible/roles/octavia/tasks/clone.yml @@ -0,0 +1,8 @@ +--- +- name: Cloning octavia source repository for development + become: true + git: + repo: "{{ octavia_git_repository }}" + dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}" + update: "{{ octavia_dev_repos_pull }}" + version: "{{ octavia_source_version }}" diff --git a/ansible/roles/octavia/tasks/deploy.yml b/ansible/roles/octavia/tasks/deploy.yml index ca35957343..d325cd7bdf 100644 --- a/ansible/roles/octavia/tasks/deploy.yml +++ b/ansible/roles/octavia/tasks/deploy.yml @@ -8,6 +8,9 @@ inventory_hostname in groups['octavia-housekeeping'] or inventory_hostname in groups['octavia-worker'] +- include_tasks: clone.yml + when: octavia_dev_mode | bool + - include_tasks: bootstrap.yml when: inventory_hostname in groups['octavia-api'] diff --git a/releasenotes/notes/add-support-octavia-dev-mod-c785e7be398c7c8e.yaml b/releasenotes/notes/add-support-octavia-dev-mod-c785e7be398c7c8e.yaml new file mode 100644 index 0000000000..a29ddc873b --- /dev/null +++ b/releasenotes/notes/add-support-octavia-dev-mod-c785e7be398c7c8e.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + add support of octavia dev mod.