Add option to configure docker_registry_mirror

This patch adds a new option to configure the docker_registry_mirror.
The motivation is to be able to make use of new infra HTTP
mirrors for docker images.

Depends-On: I4b966e9b9b174ca5a6f57974185e0149ea12f232

Change-Id: I09761ac70454e7f3fe35d0ffe32b1edb0ca217f3
This commit is contained in:
Dan Prince 2017-04-07 16:42:15 -04:00
parent 7a4734ba97
commit 19470b58ec
5 changed files with 30 additions and 0 deletions

View File

@ -713,6 +713,9 @@ tripleo::haproxy::docker_registry: true
# Docker
tripleo::profile::base::docker::step: 1
{{#DOCKER_REGISTRY_MIRROR}}
tripleo::profile::base::docker::registry_mirror: {{DOCKER_REGISTRY_MIRROR}}
{{/DOCKER_REGISTRY_MIRROR}}
# Keepalived
tripleo::keepalived::controller_virtual_ip: "%{hiera('controller_admin_host')}"

View File

@ -419,6 +419,15 @@ class TestGenerateEnvironment(BaseTestCase):
'pxe_ipmitool'])
self.assertEqual(env['INSPECTION_NODE_NOT_FOUND_HOOK'], 'enroll')
def test_docker_registry_mirror(self):
conf = config_fixture.Config()
self.useFixture(conf)
conf.config(docker_registry_mirror='http://foo/bar')
env = undercloud._generate_environment('.')
# Spot check one service
self.assertEqual('http://foo/bar',
env['DOCKER_REGISTRY_MIRROR'])
def test_generate_endpoints(self):
env = undercloud._generate_environment('.')
endpoint_vars = {k: v for (k, v) in env.items()

View File

@ -351,6 +351,11 @@ _opts = [
cfg.ListOpt('enabled_drivers',
default=['pxe_ipmitool', 'pxe_drac', 'pxe_ilo'],
help=('List of enabled bare metal drivers.')),
cfg.StrOpt('docker_registry_mirror',
default='',
help=('An optional docker \'registry-mirror\' that will be'
'configured in /etc/docker/daemon.json.')
),
]
# Passwords, tokens, hashes
@ -1079,6 +1084,9 @@ def _generate_environment(instack_root):
instack_env['ENABLED_DRIVERS'] = (
'[%s]' % ', '.join('"%s"' % drv for drv in set(enabled_drivers)))
if CONF.docker_registry_mirror:
instack_env['DOCKER_REGISTRY_MIRROR'] = CONF.docker_registry_mirror
instack_env['PUBLIC_INTERFACE_IP'] = instack_env['LOCAL_IP']
instack_env['LOCAL_IP'] = instack_env['LOCAL_IP'].split('/')[0]
if instack_env['UNDERCLOUD_SERVICE_CERTIFICATE']:

View File

@ -0,0 +1,6 @@
---
features:
- Add a new docker_registry_mirror option which can be used to
configure a registry mirror in the /etc/docker/daemon.json file.
The motivation for this change is to help support pulling images
from HTTP mirrors within CI.

View File

@ -200,6 +200,10 @@
#enabled_drivers = pxe_ipmitool,pxe_drac,pxe_ilo
# An optional docker 'registry-mirror' that will be
# configured in /etc/docker/daemon.json.
#docker_registry_mirror =
[auth]
#