From 171729ad616e9a6ea57f9b0ebf14ef584609b794 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 1 Aug 2022 11:47:31 +0900 Subject: [PATCH] Support role specific ContainerImagePrepare This is the last change of the series of changes to implements partial support for overriding the ContainerImaePrepare parameter for individual roles, so that users can use different set of images for each role. example: parameter_defaults: ContainerImagePrepare: - push_destination: true set: name_prefix: openstack- name_suffix: '' namespace: quay.io/repository/tripleowallabycentos9 ... ComputeEl8ContainerImagePrepare: - push_destination: true set: name_prefix: openstack- name_suffix: '' namespace: quay.io/repository/tripleowallabycentos8 ... This change makes the deployment command to generate the image parameters in tht according to these layered definitions. Conflicts: tripleoclient/utils.py Depends-on: https://review.opendev.org/860315 Change-Id: I76f78a12f6b4b0763a47e85f38f743da6269a47e (cherry picked from commit 0479d72909b80c0d9dec07c6a83706366600a63d) --- tripleoclient/v1/overcloud_deploy.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index d5c56cc8f..acf975ff3 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -14,6 +14,7 @@ # import argparse +import copy import os import os.path from oslo_config import cfg @@ -205,6 +206,25 @@ class DeployOvercloud(command.Command): params.update(kolla_builder.container_images_prepare_multi( env, roles_data, dry_run=True)) + + for role in roles_data: + # NOTE(tkajinam): If a role-specific container image prepare + # parameter is set, run the image prepare process + # with the overridden environment + role_param = '%sContainerImagePrepare' % role['name'] + if env.get('parameter_defaults', {}).get(role_param): + tmp_env = copy.deepcopy(env) + tmp_env['parameter_defaults']['ContainerImagePrepare'] = ( + env['parameter_defaults'][role_param] + ) + + # NOTE(tkajinam): Put the image parameters as role-specific + # parameters + params['%sParameters' % role['name']] = ( + kolla_builder.container_images_prepare_multi( + tmp_env, [role], dry_run=True) + ) + return params def create_env_files(self, parsed_args,