fix(glance_image): use common role for image updates (#3862)
Signed-off-by: Mohammed Naser <mnaser@vexxhost.com> Signed-off-by: Tadas Sutkaitis <tadas.sutkaitis@vexxhost.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mnaser <435815+mnaser@users.noreply.github.com> Co-authored-by: Mohammed Naser <mnaser@vexxhost.com> Co-authored-by: Tadas Sutkaitis <tadas.sutkaitis@vexxhost.com> Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
15 files changed
+17
-219
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ dependencies:
|
||||
kubernetes.core: 2.4.0
|
||||
openstack.cloud: ">=2.0.0"
|
||||
vexxhost.ceph: ">=3.2.0"
|
||||
atmosphere.common: ">=0.6.0"
|
||||
atmosphere.common: ">=0.7.0"
|
||||
vexxhost.kubernetes: ">=2.5.0"
|
||||
tags:
|
||||
- application
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Use the ``atmosphere.common.glance_image`` role from
|
||||
``atmosphere.common`` 0.7.0 instead of Atmosphere's local copy. This
|
||||
keeps Glance image uploads in sync with source address and HTTP ``ETag``
|
||||
changes while preserving the safer upload-before-rename behavior for
|
||||
replacing outdated service images. Atmosphere also removes the unused
|
||||
local ``qemu_utils`` role because the common role now handles QEMU tooling.
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
- name: Create images
|
||||
ansible.builtin.include_role:
|
||||
name: glance_image
|
||||
name: atmosphere.common.glance_image
|
||||
loop: "{{ glance_images }}"
|
||||
vars:
|
||||
glance_image_name: "{{ item.name }}"
|
||||
@@ -47,7 +47,7 @@
|
||||
glance_image_min_ram: "{{ item.min_ram | default(omit) }}"
|
||||
glance_image_container_format: "{{ item.container_format | default(omit) }}"
|
||||
glance_image_disk_format: "{{ item.disk_format | default(omit) }}"
|
||||
glance_image_properties: "{{ item.properties | default(omit) }}"
|
||||
glance_image_properties: "{{ item.properties | default({}) }}"
|
||||
glance_image_kernel: "{{ item.kernel | default(omit) }}"
|
||||
glance_image_ramdisk: "{{ item.ramdisk | default(omit) }}"
|
||||
glance_image_is_public: "{{ item.is_public | default(omit) }}"
|
||||
@@ -1 +0,0 @@
|
||||
# `glance_image`
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (c) 2024 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# glance_image_tempfile_path:
|
||||
|
||||
glance_image_http_proxy: "{{ http_proxy | default('') }}"
|
||||
glance_image_https_proxy: "{{ https_proxy | default('') }}"
|
||||
glance_image_no_proxy: "{{ no_proxy | default('') }}"
|
||||
@@ -1,34 +0,0 @@
|
||||
# Copyright (c) 2024 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
galaxy_info:
|
||||
author: VEXXHOST, Inc.
|
||||
description: Ansible role for managing OpenStack Glance images
|
||||
license: Apache-2.0
|
||||
min_ansible_version: 5.5.0
|
||||
standalone: false
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- "8"
|
||||
- "9"
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- focal
|
||||
- jammy
|
||||
|
||||
dependencies:
|
||||
- role: defaults
|
||||
- role: qemu_utils
|
||||
- role: openstacksdk
|
||||
@@ -1,109 +0,0 @@
|
||||
# Copyright (c) 2023 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
- name: Check if image exists
|
||||
run_once: true
|
||||
openstack.cloud.image_info:
|
||||
cloud: atmosphere
|
||||
image: "{{ glance_image_name }}"
|
||||
register: _image_info
|
||||
# NOTE(mnaser): This often fails since the SSL certificates are not
|
||||
# ready yet. We need to wait for them to be ready.
|
||||
retries: 120
|
||||
delay: 1
|
||||
until: _image_info is not failed
|
||||
|
||||
- name: Download image and upload into Glance
|
||||
run_once: true
|
||||
when: _image_info.images | length == 0
|
||||
block:
|
||||
- name: Generate temporary work directory
|
||||
ansible.builtin.tempfile:
|
||||
path: "{{ glance_image_tempfile_path | default(omit) }}"
|
||||
state: directory
|
||||
register: _workdir
|
||||
|
||||
- name: Download image
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ glance_image_url }}"
|
||||
dest: "{{ _workdir.path }}/{{ glance_image_url | basename }}"
|
||||
mode: "0600"
|
||||
tmp_dest: "{{ _workdir.path }}"
|
||||
register: _get_url
|
||||
retries: 3
|
||||
delay: "{{ 15 | random + 3 }}"
|
||||
until: _get_url is not failed
|
||||
environment:
|
||||
http_proxy: "{{ glance_image_http_proxy }}"
|
||||
https_proxy: "{{ glance_image_https_proxy }}"
|
||||
no_proxy: "{{ glance_image_no_proxy }}"
|
||||
|
||||
- name: Get image format
|
||||
changed_when: false
|
||||
ansible.builtin.shell: |
|
||||
set -o pipefail
|
||||
qemu-img info {{ _get_url.dest }} | grep -i "file format" | awk '{ print $3 }'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: _image_format
|
||||
|
||||
- name: Convert file to target disk format
|
||||
when:
|
||||
- glance_image_disk_format not in ['aki', 'ari']
|
||||
- glance_image_disk_format != _image_format.stdout
|
||||
changed_when: true
|
||||
ansible.builtin.command:
|
||||
qemu-img convert -O {{ glance_image_disk_format }} {{ _get_url.dest }} {{ _get_url.dest }}.converted
|
||||
register: glance_image_conversion
|
||||
|
||||
- name: Wait until image service ready
|
||||
kubernetes.core.k8s_info:
|
||||
api_version: apps/v1
|
||||
kind: Deployment
|
||||
name: glance-api
|
||||
namespace: openstack
|
||||
wait_sleep: 1
|
||||
wait_timeout: 600
|
||||
wait: true
|
||||
wait_condition:
|
||||
type: Available
|
||||
status: true
|
||||
|
||||
- name: Upload image into Glance
|
||||
openstack.cloud.image:
|
||||
cloud: atmosphere
|
||||
name: "{{ glance_image_name }}"
|
||||
filename: "{{ _get_url.dest }}{% if glance_image_conversion is not skipped %}.converted{% endif %}"
|
||||
min_disk: "{{ glance_image_min_disk | default(omit) }}"
|
||||
min_ram: "{{ glance_image_min_ram | default(omit) }}"
|
||||
container_format: "{{ glance_image_container_format | default(omit) }}"
|
||||
disk_format: "{{ glance_image_disk_format | default(omit) }}"
|
||||
properties: "{{ glance_image_properties | default(omit) }}"
|
||||
kernel: "{{ glance_image_kernel | default(omit) }}"
|
||||
ramdisk: "{{ glance_image_ramdisk | default(omit) }}"
|
||||
is_public: "{{ glance_image_is_public | default(omit) }}"
|
||||
tags: "{{ glance_image_tags | default(omit) }}"
|
||||
wait: true
|
||||
timeout: 600
|
||||
# NOTE(mnaser): This often fails since the SSL certificates are not
|
||||
# ready yet. We need to wait for them to be ready.
|
||||
retries: "{{ glance_image_retries | default(60) }}"
|
||||
delay: 5
|
||||
register: _result
|
||||
until: _result is not failed
|
||||
always:
|
||||
- name: Remove work directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ _workdir.path }}"
|
||||
state: absent
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
- name: Upload images
|
||||
ansible.builtin.include_role:
|
||||
name: glance_image
|
||||
name: atmosphere.common.glance_image
|
||||
loop:
|
||||
- name: "{{ ironic_python_agent_deploy_kernel_name }}"
|
||||
url: "{{ ironic_python_agent_deploy_kernel_url }}"
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
|
||||
- name: Upload images
|
||||
ansible.builtin.include_role:
|
||||
name: glance_image
|
||||
name: atmosphere.common.glance_image
|
||||
loop: "{{ magnum_images }}"
|
||||
vars:
|
||||
glance_image_name: "{{ item.name }}"
|
||||
|
||||
@@ -35,7 +35,7 @@ manila_flavor_extra_specs: {}
|
||||
|
||||
# Service instance image
|
||||
manila_image_name: manila-service-image
|
||||
manila_image_url: "https://object-storage.public.mtl1.vexxhost.net/swift/v1/b98c5fdfb9be4e39a34b93d0b425ac2b/atmosphere-images/manila-{{ atmosphere_version | regex_replace('-beta.','b') }}.qcow2" # noqa yaml[line-length]
|
||||
manila_image_url: https://github.com/vexxhost/manila-service-images/releases/download/2026.05-3/manila-service-image.qcow2
|
||||
manila_image_container_format: bare
|
||||
manila_image_disk_format: qcow2
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
- name: Upload service image
|
||||
ansible.builtin.include_role:
|
||||
name: glance_image
|
||||
name: atmosphere.common.glance_image
|
||||
vars:
|
||||
glance_image_name: "{{ manila_image_name }}"
|
||||
glance_image_url: "{{ manila_image_url }}"
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
- name: Upload Amphora image
|
||||
ansible.builtin.include_role:
|
||||
name: glance_image
|
||||
name: atmosphere.common.glance_image
|
||||
vars:
|
||||
glance_image_name: "{{ octavia_amphora_image_name }}"
|
||||
glance_image_url: "{{ octavia_amphora_image_url }}"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
# `qemu-utils`
|
||||
@@ -1,29 +0,0 @@
|
||||
# Copyright (c) 2024 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
galaxy_info:
|
||||
author: VEXXHOST, Inc.
|
||||
description: Install QEMU utilities
|
||||
license: Apache-2.0
|
||||
min_ansible_version: 5.5.0
|
||||
standalone: false
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- "8"
|
||||
- "9"
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- focal
|
||||
- jammy
|
||||
@@ -1,18 +0,0 @@
|
||||
# Copyright (c) 2024 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
- name: Install packages
|
||||
ansible.builtin.package:
|
||||
name: "{{ 'qemu-utils' if ansible_facts['os_family'] in ['Debian'] else 'qemu-img' }}"
|
||||
state: present
|
||||
Reference in new issue
Block a user