From 95eee6bc11e97105cb0356d7475bee699d404bda 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. 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 82fad4b1..5f3f982a 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 248f2f23..9aac629d 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 =1.3" - - dib-utils - - PyYAML - name: Clone Octavia git: repo: "https://git.openstack.org/openstack/octavia" @@ -53,19 +36,6 @@ version: "{{ octavia_git_install_branch }}" tags: - skip_ansible_lint - - 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 8ae51f53..58efcd46 100644 --- a/tests/test-octavia.yml +++ b/tests/test-octavia.yml @@ -77,17 +77,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 ""