Configure undercloud docker registry/mirror

Wires in support to configure the Docker undercloud
registry and mirror.

Change-Id: If5b00416afbc334bdb520dada4ae800c33d51c92
This commit is contained in:
Dan Prince 2017-12-06 14:00:43 -05:00 committed by Emilien Macchi
parent f4d1521965
commit 52b71ea76e
1 changed files with 18 additions and 0 deletions

View File

@ -322,6 +322,11 @@ _opts = [
help=('An optional docker \'registry-mirror\' that will be'
'configured in /etc/docker/daemon.json.')
),
cfg.ListOpt('docker_insecure_registries',
default=[],
help=('Used to add custom insecure registries in '
'/etc/sysconfig/docker.')
),
cfg.StrOpt('templates',
default='',
help=('heat templates file to override.')
@ -450,6 +455,10 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False):
deploy_args = []
_load_config()
# Set the undercloud home dir parameter so that stackrc is produced in
# the users home directory.
env_data['UndercloudHomeDir'] = os.environ.get('HOME', '')
for param_key, param_value in PARAMETER_MAPPING.items():
if param_key in CONF.keys():
env_data[param_value] = CONF[param_key]
@ -465,6 +474,15 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False):
if CONF.get('undercloud_ntp_servers', None):
env_data['NtpServer'] = CONF['undercloud_ntp_servers'][0]
# FIXME need to add admin VIP as well
env_data['DockerInsecureRegistryAddress'] = [
'%s:8787' % CONF['local_ip'].split('/')[0]]
env_data['DockerInsecureRegistryAddress'].extend(
CONF['docker_insecure_registries'])
if CONF.get('docker_registry_mirror', None):
env_data['DockerRegistryMirror'] = CONF['docker_registry_mirror']
if CONF.get('local_ip', None):
# local_ip is defined as a CIDR
just_local_ip = CONF['local_ip'].split('/')[0]