[queens-only] include local_ip & undercloud_admin_host in docker_insecure_registries

This patch includes by default the local_ip and undercloud_admin_host in
docker_insecure_registries parameter, that can be missed but actually
needed in some cases.

This code was done in tripleoclient for the containerized undercloud in
Rocky, so we just need to port it here for stable versions, to have the
same behavior.

Change-Id: I03be8381ec776fd769139c79b85470acedc64d2b
Closes-Bug: #1799784
This commit is contained in:
Emilien Macchi 2018-10-24 17:09:58 -04:00
parent 1c58cb1e8c
commit 0fd8cd3f30
2 changed files with 7 additions and 8 deletions

View File

@ -592,7 +592,8 @@ class TestGenerateEnvironment(BaseTestCase):
env = undercloud._generate_environment('.')
insecure_registries = json.loads(env['DOCKER_INSECURE_REGISTRIES'])
# Spot check one service
self.assertEqual(['http://foo/bar:8787'], insecure_registries)
self.assertEqual(['192.168.24.1:8787', '192.168.24.3:8787',
'http://foo/bar:8787'], insecure_registries)
def test_generate_endpoints(self):
env = undercloud._generate_environment('.')

View File

@ -1434,14 +1434,12 @@ def _generate_environment(instack_root):
if CONF.docker_registry_mirror:
instack_env['DOCKER_REGISTRY_MIRROR'] = CONF.docker_registry_mirror
insecure_reg = ([instack_env['LOCAL_IP'] + ':' + '8787',
CONF.undercloud_admin_host + ':' + '8787'])
if CONF.docker_insecure_registries:
instack_env['DOCKER_INSECURE_REGISTRIES'] = json.dumps(
CONF.docker_insecure_registries)
else:
# For backward compatibility with previous defaults
instack_env['DOCKER_INSECURE_REGISTRIES'] = json.dumps(
[instack_env['LOCAL_IP'] + ':' + '8787',
CONF.undercloud_admin_host + ':' + '8787'])
insecure_reg.extend(CONF['docker_insecure_registries'])
instack_env['DOCKER_INSECURE_REGISTRIES'] = json.dumps(insecure_reg)
# We're not in a chroot so this doesn't make sense, and it causes weird
# errors if it's set.