diff --git a/doc/source/administration/overcloud.rst b/doc/source/administration/overcloud.rst index 30082cceb..c75f169ff 100644 --- a/doc/source/administration/overcloud.rst +++ b/doc/source/administration/overcloud.rst @@ -84,6 +84,31 @@ service by the name of that service. For example: ``nova``, ``neutron`` or (kayobe) $ kayobe overcloud service reconfigure --tags config --kolla-tags nova,ironic +Deploying Updated Container Images +================================== + +A common task is to deploy updated container images, without configuration +changes. This might be to roll out an updated container OS or to pick up some +package updates. This should be faster than a full deployment or +reconfiguration. + +To deploy updated container images:: + + (kayobe) $ kayobe overcloud service deploy containers + +Note that if there are configuration changes, these will not be applied using +this command so if in doubt, use a normal ``kayobe overcloud service deploy``. + +In case not all services' containers have been modified, performance can be +improved by specifying Ansible tags to limit the tasks run in kayobe and/or +kolla-ansible's playbooks. This may require knowledge of the inner workings of +these tools but in general, kolla-ansible tags the play used to configure each +service by the name of that service. For example: ``nova``, ``neutron`` or +``ironic``. Use ``-t`` or ``--tags`` to specify kayobe tags and ``-kt`` or +``--kolla-tags`` to specify kolla-ansible tags. For example:: + + (kayobe) $ kayobe overcloud service deploy containers --kolla-tags nova,ironic + Upgrading Containerised Services ================================ diff --git a/kayobe/cli/commands.py b/kayobe/cli/commands.py index 26a7418a5..1d4949d4f 100644 --- a/kayobe/cli/commands.py +++ b/kayobe/cli/commands.py @@ -1233,6 +1233,49 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin, self.run_kayobe_playbooks(parsed_args, playbooks, ignore_limit=True) +class OvercloudServiceDeployContainers(KollaAnsibleMixin, KayobeAnsibleMixin, + VaultMixin, Command): + """Deploy the overcloud services without updating configuration. + + * Configure kolla-ansible. + * Configure overcloud services in kolla-ansible. + * Perform kolla-ansible prechecks to verify the system state for + deployment. + * Perform a kolla-ansible deployment of the overcloud service containers. + * Configure and deploy kayobe extra services. + + This can be used in conjunction with the --tags and --kolla-tags arguments + to deploy specific services. + """ + + def get_parser(self, prog_name): + parser = super(OvercloudServiceDeployContainers, self).get_parser( + prog_name) + group = parser.add_argument_group("Service Deployment") + group.add_argument("--skip-prechecks", action='store_true', + help="skip the kolla-ansible prechecks command") + return parser + + def take_action(self, parsed_args): + self.app.LOG.debug("Deploying overcloud services (containers only)") + + # First prepare configuration. + self.generate_kolla_ansible_config(parsed_args) + + # Run kolla-ansible prechecks before deployment. + if not parsed_args.skip_prechecks: + self.run_kolla_ansible_overcloud(parsed_args, "prechecks") + + # Perform the kolla-ansible deployment. + self.run_kolla_ansible_overcloud(parsed_args, "deploy-containers") + + # Deploy kayobe extra services. + playbooks = _build_playbook_list("overcloud-extras") + extra_vars = {"kayobe_action": "deploy"} + self.run_kayobe_playbooks(parsed_args, playbooks, + extra_vars=extra_vars, limit="overcloud") + + class OvercloudServiceReconfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin, Command): """Reconfigure the overcloud services. diff --git a/kayobe/tests/unit/cli/test_commands.py b/kayobe/tests/unit/cli/test_commands.py index 9d38ea6a0..73a7e3061 100644 --- a/kayobe/tests/unit/cli/test_commands.py +++ b/kayobe/tests/unit/cli/test_commands.py @@ -1571,6 +1571,60 @@ class TestCase(unittest.TestCase): ] self.assertEqual(expected_calls, mock_kolla_run.call_args_list) + @mock.patch.object(commands.KayobeAnsibleMixin, + "run_kayobe_playbooks") + @mock.patch.object(commands.KollaAnsibleMixin, + "run_kolla_ansible_overcloud") + def test_overcloud_service_deploy_containers(self, mock_kolla_run, + mock_run): + command = commands.OvercloudServiceDeployContainers(TestApp(), []) + parser = command.get_parser("test") + parsed_args = parser.parse_args([]) + + result = command.run(parsed_args) + self.assertEqual(0, result) + + expected_calls = [ + mock.call( + mock.ANY, + [utils.get_data_files_path("ansible", "kolla-ansible.yml")], + ignore_limit=True, + tags="config", + ), + mock.call( + mock.ANY, + [ + utils.get_data_files_path("ansible", + "kolla-openstack.yml"), + ], + ignore_limit=True, + ), + mock.call( + mock.ANY, + [ + utils.get_data_files_path("ansible", + "overcloud-extras.yml"), + ], + limit="overcloud", + extra_vars={ + "kayobe_action": "deploy", + }, + ), + ] + self.assertEqual(expected_calls, mock_run.call_args_list) + + expected_calls = [ + mock.call( + mock.ANY, + "prechecks", + ), + mock.call( + mock.ANY, + "deploy-containers", + ), + ] + self.assertEqual(expected_calls, mock_kolla_run.call_args_list) + @mock.patch.object(commands.KayobeAnsibleMixin, "run_kayobe_playbooks") @mock.patch.object(commands.KollaAnsibleMixin, diff --git a/releasenotes/notes/support-deploy-containers-7acf4c647fb5c3fa.yaml b/releasenotes/notes/support-deploy-containers-7acf4c647fb5c3fa.yaml new file mode 100644 index 000000000..08f3d40ec --- /dev/null +++ b/releasenotes/notes/support-deploy-containers-7acf4c647fb5c3fa.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Adds a new ``kayobe overcloud service deploy containers`` command. This is + similar to ``kayobe overcloud service deploy``, but only deploys new + containers if necessary, and skips service registration, bootstrapping and + configuration. diff --git a/setup.cfg b/setup.cfg index 1ac302a28..377ebfdaf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -70,6 +70,7 @@ kayobe.cli= overcloud_service_configuration_save = kayobe.cli.commands:OvercloudServiceConfigurationSave overcloud_service_configuration_generate = kayobe.cli.commands:OvercloudServiceConfigurationGenerate overcloud_service_deploy = kayobe.cli.commands:OvercloudServiceDeploy + overcloud_service_deploy_containers = kayobe.cli.commands:OvercloudServiceDeployContainers overcloud_service_destroy = kayobe.cli.commands:OvercloudServiceDestroy overcloud_service_reconfigure = kayobe.cli.commands:OvercloudServiceReconfigure overcloud_service_upgrade = kayobe.cli.commands:OvercloudServiceUpgrade