Allow to configure where to deploy a Docker Registry

This commit changes the docker-registry playbook to deploy a Docker
Registry on hosts in the docker-registry group, rather than being
harcoded to deploy on the first controller.

The default location is changed to deploy on the seed as it appears to
be a good location for most deployments.

UpgradeImpact: The Docker Registry is now deployed on the seed by
default.

Change-Id: I87d02bd9556afb795c8783ed78e797fdd31fe8ca
Story: 2004820
Task: 28986
This commit is contained in:
Pierre Riteau 2019-01-29 15:44:21 +00:00
parent 837284f08b
commit ce49ae7c80
5 changed files with 31 additions and 1 deletions

View File

@ -7,7 +7,7 @@
# action: One of deploy, destroy, pull, reconfigure, upgrade
- name: Ensure a local Docker registry is deployed
hosts: controllers[0]
hosts: docker-registry
tags:
- docker-registry
roles:

View File

@ -53,6 +53,12 @@ monitoring
storage
compute
[docker-registry:children]
# Hosts in this group will have a Docker Registry deployed. This group should
# generally contain only a single host, to avoid deploying multiple independent
# registries which may become unsynchronized.
seed
###############################################################################
# Baremetal compute node groups.

View File

@ -367,6 +367,7 @@ class SeedHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
* Optionally, create a virtualenv for kolla-ansible.
* Configure a user account for kolla-ansible.
* Configure Docker engine.
* Optionally, deploy a Docker Registry.
"""
def get_parser(self, prog_name):
@ -439,6 +440,12 @@ class SeedHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
self.run_kayobe_playbooks(parsed_args, playbooks,
extra_vars=extra_vars, limit="seed")
# Optionally, deploy a Docker Registry.
playbooks = _build_playbook_list("docker-registry")
extra_vars = {"kayobe_action": "deploy"}
self.run_kayobe_playbooks(parsed_args, playbooks,
extra_vars=extra_vars, limit="seed")
class SeedHostPackageUpdate(KayobeAnsibleMixin, VaultMixin, Command):
"""Update packages on the seed host."""

View File

@ -344,6 +344,14 @@ class TestCase(unittest.TestCase):
limit="seed",
extra_vars={'pip_applicable_users': [None]},
),
mock.call(
mock.ANY,
[
"ansible/docker-registry.yml",
],
limit="seed",
extra_vars={'kayobe_action': 'deploy'},
),
]
self.assertEqual(expected_calls, mock_run.call_args_list)

View File

@ -0,0 +1,9 @@
---
upgrade:
- |
When enabled, a Docker Registry is now deployed on hosts in the
``docker-registry`` group, which defaults to include the seed. The existing
behaviour of deploying on the first controller can be retained by removing
the seed group from ``[docker-registry:children]`` in
``$KAYOBE_CONFIG_PATH/inventory/groups` and creating a
``[docker-registry]`` group including the name of the first controller.