Change network_mode default to host

Kolla-Ansible deploys Docker without bridge by default [1].

[1]: https://review.opendev.org/c/openstack/kolla-ansible/+/751795

Change-Id: I7430b72f5d8abe59a7151df73e6d59898d942636
This commit is contained in:
Michał Nasiadka 2021-06-07 13:56:48 +02:00 committed by Radosław Piliszek
parent a6884085e1
commit d7252ba582
3 changed files with 17 additions and 11 deletions

View File

@ -174,7 +174,7 @@ _CLI_OPTS = [
help='Show all available images (filtering supported)'),
cfg.StrOpt('namespace', short='n', default='kolla',
help='The Docker namespace name'),
cfg.StrOpt('network_mode', default=None,
cfg.StrOpt('network_mode', default='host',
help='The network mode for Docker build. Example: host'),
cfg.BoolOpt('cache', default=True,
help='Use the Docker cache when building'),

View File

@ -166,8 +166,8 @@ class TasksTest(base.TestCase):
mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode=None, nocache=False, rm=True, pull=True, forcerm=True,
buildargs=None)
network_mode='host', nocache=False, rm=True, pull=True,
forcerm=True, buildargs=None)
self.assertTrue(builder.success)
@ -176,14 +176,14 @@ class TasksTest(base.TestCase):
def test_build_image_with_network_mode(self, mock_client):
self.dc = mock_client
push_queue = mock.Mock()
self.conf.set_override('network_mode', 'host')
self.conf.set_override('network_mode', 'bridge')
builder = build.BuildTask(self.conf, self.image, push_queue)
builder.run()
mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode='host', nocache=False, rm=True, pull=True,
network_mode='bridge', nocache=False, rm=True, pull=True,
forcerm=True, buildargs=None)
self.assertTrue(builder.success)
@ -203,8 +203,8 @@ class TasksTest(base.TestCase):
mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode=None, nocache=False, rm=True, pull=True, forcerm=True,
buildargs=build_args)
network_mode='host', nocache=False, rm=True, pull=True,
forcerm=True, buildargs=build_args)
self.assertTrue(builder.success)
@ -222,8 +222,8 @@ class TasksTest(base.TestCase):
mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode=None, nocache=False, rm=True, pull=True, forcerm=True,
buildargs=build_args)
network_mode='host', nocache=False, rm=True, pull=True,
forcerm=True, buildargs=build_args)
self.assertTrue(builder.success)
@ -243,8 +243,8 @@ class TasksTest(base.TestCase):
mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode=None, nocache=False, rm=True, pull=True, forcerm=True,
buildargs=build_args)
network_mode='host', nocache=False, rm=True, pull=True,
forcerm=True, buildargs=build_args)
self.assertTrue(builder.success)

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
Changed default of ``network_mode`` to ``host`` since Kolla-Ansible
``bootstrap-servers`` is deploying Docker without a bridge by default
since `Wallaby <https://review.opendev.org/c/openstack/kolla-ansible/+/751795>`__