Skip to content
Merged
2 changes: 1 addition & 1 deletion doc/source/support_matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The following base container images are supported:
Distribution Default base Default base tag
================== =============================== ================
Rocky Linux quay.io/rockylinux/rockylinux 9
Debian Bullseye debian bullseye
Debian Bookworm debian bookworm
Ubuntu Jammy ubuntu 22.04
Ubuntu Noble ubuntu 24.04
================== =============================== ================
Expand Down
14 changes: 9 additions & 5 deletions docker/base/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,23 @@ RUN cat /tmp/kolla_bashrc >> /etc/bash.bashrc \
{% if base_distro == 'debian' %}
RUN rm -f /etc/apt/sources.list.d/debian.sources
COPY sources.list.{{ base_distro }} /etc/apt/sources.list
{% elif ( base_distro == 'ubuntu' and base_arch == 'x86_64' ) %}
{% elif base_distro == 'ubuntu' %}
{% if base_distro_tag.startswith('22.04') or base_distro_tag.startswith('jammy') %}
RUN rm -f /etc/apt/sources.list
{% if base_arch == 'x86_64' %}
COPY sources.list.{{ base_distro }}.jammy /etc/apt/sources.list
{% else %}
COPY sources.list.{{ base_distro }}.jammy.{{ base_arch }} /etc/apt/sources.list
{% endif %}
{% elif base_distro_tag.startswith('24.04') or base_distro_tag.startswith('noble') %}
RUN rm -f /etc/apt/sources.list.d/{{ base_distro }}.sources
{% if base_arch == 'x86_64' %}
COPY sources.list.{{ base_distro }}.noble /etc/apt/sources.list
{% endif %}
{% else %}
{% if base_distro_tag.startswith('22.04') or base_distro_tag.startswith('jammy')%}
COPY sources.list.{{ base_distro }}.jammy.{{ base_arch }} /etc/apt/sources.list
{% elif base_distro_tag.startswith('24.04') or base_distro_tag.startswith('noble')%}
COPY sources.list.{{ base_distro }}.noble.{{ base_arch }} /etc/apt/sources.list
{% endif %}
{% endif %}
{% endif %}
COPY sources.list /etc/apt/sources.list.d/kolla-custom.list
{% endblock %}

Expand Down
6 changes: 3 additions & 3 deletions kolla/common/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@
'elasticsearch_exporter'
'-${version}.linux-${debian_arch}.tar.gz')},
'prometheus-libvirt-exporter': {
'version': '1.6.0',
'version': '2.2.0',
'type': 'url',
'sha256': {
'amd64': '57f1e71ac5bd87f18a40b9089e9fb513dec44ced58328b3065879b279f967596', # noqa: E501
'arm64': '8f474fbb515caf19fda92c839eece761738138c7c676d12d10aa0b8c29b3ef9d'}, # noqa: E501
'amd64': '37e26779be1ebaef2e76d7304a3d3ecfbdc232a5c57645ee0f97b13f014bd842', # noqa: E501
'arm64': '94ac011349d60d70c14985df2942d02ecac87c0b7c7a468133394eb1800a22b0'}, # noqa: E501
'location': ('https://github.com/'
'inovex/prometheus-libvirt-exporter/'
'releases/download/v${version}/'
Expand Down
10 changes: 10 additions & 0 deletions kolla/image/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ def run(self):

def push_image(self, image):
kwargs = dict(stream=True, decode=True)
# NOTE(bbezak): Docker ≥ 28.3.3 rejects a push with no
# X-Registry-Auth header (moby/moby#50371, docker-py#3348).
# If the SDK cannot find creds for this registry, we inject
# an empty {} so the daemon still accepts the request.
# TODO(bbezak): Remove fallback once docker-py handles empty auth
if self.conf.engine == engine.Engine.DOCKER.value:
from docker.auth import resolve_authconfig
if not resolve_authconfig(self.engine_client.api._auth_configs,
registry=self.conf.registry):
kwargs.setdefault("auth_config", {})

for response in self.engine_client.images.push(image.canonical_name,
**kwargs):
Expand Down
20 changes: 15 additions & 5 deletions kolla/tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,26 @@ def setUp(self):
@mock.patch(engine_client)
def test_push_image(self, mock_client):
self.engine_client = mock_client
mock_client().api._auth_configs = {}
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
self.image.canonical_name, decode=True, stream=True)
self.image.canonical_name,
decode=True, stream=True, auth_config={})
self.assertTrue(pusher.success)

@mock.patch.dict(os.environ, clear=True)
@mock.patch(engine_client)
def test_push_image_failure(self, mock_client):
"""failure on connecting Docker API"""
self.engine_client = mock_client
mock_client().api._auth_configs = {}
mock_client().images.push.side_effect = Exception
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
self.image.canonical_name, decode=True, stream=True)
self.image.canonical_name,
decode=True, stream=True, auth_config={})
self.assertFalse(pusher.success)
self.assertEqual(utils.Status.PUSH_ERROR, self.image.status)

Expand All @@ -105,11 +109,13 @@ def test_push_image_failure(self, mock_client):
def test_push_image_failure_retry(self, mock_client):
"""failure on connecting Docker API, success on retry"""
self.engine_client = mock_client
mock_client().api._auth_configs = {}
mock_client().images.push.side_effect = [Exception, []]
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
self.image.canonical_name, decode=True, stream=True)
self.image.canonical_name,
decode=True, stream=True, auth_config={})
self.assertFalse(pusher.success)
self.assertEqual(utils.Status.PUSH_ERROR, self.image.status)

Expand All @@ -125,12 +131,14 @@ def test_push_image_failure_retry(self, mock_client):
def test_push_image_failure_error(self, mock_client):
"""Docker connected, failure to push"""
self.engine_client = mock_client
mock_client().api._auth_configs = {}
mock_client().images.push.return_value = [{'errorDetail': {'message':
'mock push fail'}}]
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
self.image.canonical_name, decode=True, stream=True)
self.image.canonical_name,
decode=True, stream=True, auth_config={})
self.assertFalse(pusher.success)
self.assertEqual(utils.Status.PUSH_ERROR, self.image.status)

Expand All @@ -139,12 +147,14 @@ def test_push_image_failure_error(self, mock_client):
def test_push_image_failure_error_retry(self, mock_client):
"""Docker connected, failure to push, success on retry"""
self.engine_client = mock_client
mock_client().api._auth_configs = {}
mock_client().images.push.return_value = [{'errorDetail': {'message':
'mock push fail'}}]
pusher = tasks.PushTask(self.conf, self.image)
pusher.run()
mock_client().images.push.assert_called_once_with(
self.image.canonical_name, decode=True, stream=True)
self.image.canonical_name,
decode=True, stream=True, auth_config={})
self.assertFalse(pusher.success)
self.assertEqual(utils.Status.PUSH_ERROR, self.image.status)

Expand Down
10 changes: 10 additions & 0 deletions releasenotes/notes/bug-2120639-74c180bd812ddcf7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
fixes:
- |
Fixed missing metrics in Prometheus libvirt exporter.

The Prometheus libvirt exporter has been bumped from ``v1.6.0`` to
``v2.2.0``. This restores some metrics that were lost when the exporter
source was changed in a previous release.

`LP#2120639 <https://launchpad.net/bugs/2120639>`__.
2 changes: 1 addition & 1 deletion tests/playbooks/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
vars:
kolla_mirror_config:
DEFAULT:
base_image: "quay.io/openstack.kolla/{{ base_distro }}"
base_image: "quay.io/opendevmirror/{{ base_distro }}"
set_fact:
kolla_build_config: "{{ kolla_build_config | combine(kolla_mirror_config, recursive=True) }}"
when: base_distro in ['debian', 'ubuntu']
Expand Down