From d162040d76a2048de0ecc7deb8999c16e0f97d06 Mon Sep 17 00:00:00 2001 From: German Eichberger Date: Wed, 21 Mar 2018 15:20:55 -0700 Subject: [PATCH] Downloads amphora images from artifact storage This will download a test amphora image per default form the Open Stack artifact storage to speed up tests. Operators can configure their won artifact storage to simplify deploys. (cherry picked from commit 95eee6bc11e97105cb0356d7475bee699d404bda0) Change-Id: I408d4128d35aab889dbe89fd9497d83a7830129b --- defaults/main.yml | 17 ++- doc/source/configure-octavia.rst | 14 +++ .../image_download-754d13e7df9b7891.yaml | 16 +++ tasks/main.yml | 4 + tasks/octavia_amp_image.yml | 105 ++++++++++++++++++ tasks/octavia_post_install.yml | 48 -------- tests/os_octavia-overrides.yml | 1 + tests/test-configure-octavia.yml | 30 ----- tests/test-octavia.yml | 11 -- 9 files changed, 153 insertions(+), 93 deletions(-) create mode 100644 releasenotes/notes/image_download-754d13e7df9b7891.yaml create mode 100644 tasks/octavia_amp_image.yml diff --git a/defaults/main.yml b/defaults/main.yml index 859ac577..37ffe621 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -238,12 +238,21 @@ octavia_glance_image_tag: octavia-amphora-image octavia_amp_image_owner_id: # add here the glance image id if tagging is not used (not recommended for prod) octavia_amp_image_id: -# add here the file name of the image if it should be uplaoded automatically -# Note: This does not support image tags so don't use for prod +# download the image from an artefact server +# Note: The default is the Octavia test image so don't use that in prod +octavia_download_artefact: True +# The host to download images to if enabled +# Options are ['deployment-host', 'target-host'] +octavia_image_downloader: "deployment-host" +# The URL to downlaod from +octavia_artefact_url: http://tarballs.openstack.org/octavia/test-images/test-only-amphora-x64-haproxy-ubuntu-xenial.qcow2 +# the directory to store the downloaded file to +octavia_amp_image_path: "~/" +# add here the file name of the image if it should be uploaded automatically octavia_amp_image_file_name: # enable uploading image to glance automatically -# Note: This does not support image tags so don't use for prod -octavia_amp_image_upload_enabled: False +octavia_amp_image_upload_enabled: "{{ octavia_download_artefact }}" + # Name of the Octavia security group octavia_security_group_name: octavia_sec_grp # Restrict access to only authorized hosts diff --git a/doc/source/configure-octavia.rst b/doc/source/configure-octavia.rst index 3cef99b3..4447bf63 100644 --- a/doc/source/configure-octavia.rst +++ b/doc/source/configure-octavia.rst @@ -76,6 +76,16 @@ ips which overlap with ips assigned to hosts or containers (see the Building Octavia images ~~~~~~~~~~~~~~~~~~~~~~~ +.. note:: + The default behavior is to download a test image from the OpenStack artifact + storage the Octavia team provides daily. Because this image doesn't apply + operating system security patches in a timely manner it is unsuited + for production use. + + Some Operating System vendors might provide official amphora builds or an + organization might maintain their own artifact storage - for those cases the + automatic download can be leveraged, too. + Images using the ``diskimage-builder`` must be built outside of a container. For this process, use one of the physical hosts within the environment. @@ -115,6 +125,10 @@ For this process, use one of the physical hosts within the environment. glance image-create --name amphora-x64-haproxy --visibility private --disk-format qcow2 \ --container-format bare --tags octavia-amphora-image 0)) | ternary('octavia_api', 'all_containers') }}" diff --git a/tests/test-configure-octavia.yml b/tests/test-configure-octavia.yml index 1fc1e79b..889e7667 100644 --- a/tests/test-configure-octavia.yml +++ b/tests/test-configure-octavia.yml @@ -28,42 +28,12 @@ retries: 5 delay: 2 with_items: - - qemu - - uuid-runtime - - curl - - kpartx - git - - name: Install pip requirements - pip: - name: "{{ item }}" - state: "{{ octavia_pip_package_state }}" - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - with_items: - - argparse - - "Babel>=1.3" - - dib-utils - - PyYAML - name: Clone Octavia git: repo: "https://git.openstack.org/openstack/octavia" dest: "{{ octavia_system_home_folder }}/octavia" version: "{{ octavia_git_install_branch }}" - - name: Clone Diskimage-Builder - git: - repo: "https://git.openstack.org/openstack/diskimage-builder" - dest: "{{ octavia_system_home_folder }}/diskimage-builder" - version: "2.9.0" - - name: Create amphora image - shell: "./diskimage-create.sh -o {{ octavia_system_home_folder }}/amphora-x64-haproxy.qcow2" - args: - chdir: "{{ octavia_system_home_folder }}/octavia/diskimage-create" - creates: "{{ octavia_system_home_folder }}/amphora-x64-haproxy.qcow2" - when: test_octavia_amphora | bool - tags: - - skip_ansible_lint - name: Change permission file: path: "{{ octavia_system_home_folder }}/octavia/bin/create_certificates.sh" diff --git a/tests/test-octavia.yml b/tests/test-octavia.yml index 7d0cd36d..5f69e6b4 100644 --- a/tests/test-octavia.yml +++ b/tests/test-octavia.yml @@ -73,17 +73,6 @@ network_name: "public" name: "public-subnet" cidr: "10.1.3.0/24" - - name: Upload image to glance - shell: >- - glance image-create --name amphora-x64-haproxy --visibility private --disk-format qcow2 \ - --container-format bare --tags octavia-amphora-image <{{ octavia_system_home_folder }}/amphora-x64-haproxy.qcow2 \ - && touch {{ octavia_system_home_folder }}/image - args: - creates: "{{ octavia_system_home_folder }}/image" - environment: "{{ env }}" - when: test_octavia_amphora | bool - tags: - - skip_ansible_lint - name: Create ssh-key shell: > cat /dev/zero | ssh-keygen -q -N ""