Default Heat images to container image prepare defaults

Use the defaults from container image prepare to set the default values
for the standalone and undercloud heat api and engine images. This will
allow the default upstream or downstream defaults from the right branch
to be used.

Additionally this patch splits out the ephemeral heat containers to a
special namespace and tag that we use in THT to setup the containers for
the overcloud deploy command on an undercloud.

related-bug: 1931995
Depends-On: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/796617
Change-Id: I55fb9816e2b0a54717938b7a094bde6780811305
Signed-off-by: James Slagle <jslagle@redhat.com>
Signed-off-by: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
James Slagle 2021-06-23 07:35:18 -04:00
parent 4cf79c5c3a
commit 268f638f15
2 changed files with 47 additions and 17 deletions

View File

@ -18,6 +18,7 @@ import sys
from osc_lib.i18n import _
from six.moves import configparser
from tripleo_common.image import kolla_builder
TRIPLEO_ARCHIVE_DIR = "/var/lib/tripleo/archive"
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
@ -42,18 +43,34 @@ DEFAULT_CONTAINER_REGISTRY = "quay.io"
DEFAULT_CONTAINER_NAMESPACE = "tripleomaster"
DEFAULT_CONTAINER_TAG = "current-tripleo"
DEFAULT_RESOURCE_REGISTRY = 'overcloud-resource-registry-puppet.yaml'
DEFAULT_HEAT_CONTAINER = ('{}/{}/openstack-heat-all:{}'.format(
DEFAULT_CONTAINER_REGISTRY,
DEFAULT_CONTAINER_NAMESPACE,
DEFAULT_CONTAINER_TAG))
DEFAULT_HEAT_API_CONTAINER = ('{}/{}/openstack-heat-api:{}'.format(
DEFAULT_CONTAINER_REGISTRY,
DEFAULT_CONTAINER_NAMESPACE,
DEFAULT_CONTAINER_TAG))
DEFAULT_HEAT_ENGINE_CONTAINER = ('{}/{}/openstack-heat-engine:{}'.format(
DEFAULT_CONTAINER_REGISTRY,
DEFAULT_CONTAINER_NAMESPACE,
DEFAULT_CONTAINER_TAG))
if os.path.isfile(kolla_builder.DEFAULT_PREPARE_FILE):
kolla_builder.init_prepare_defaults(kolla_builder.DEFAULT_PREPARE_FILE)
DEFAULT_CONTAINER_IMAGE_PARAMS = kolla_builder.CONTAINER_IMAGES_DEFAULTS
else:
DEFAULT_CONTAINER_IMAGE_PARAMS = {
'namespace': 'quay.io/tripleomaster',
'name_prefix': 'openstack-',
'tag': 'current-tripleo'
}
DEFAULT_HEAT_CONTAINER = ('{}/{}heat-all:{}'.format(
DEFAULT_CONTAINER_IMAGE_PARAMS['namespace'],
DEFAULT_CONTAINER_IMAGE_PARAMS['name_prefix'],
DEFAULT_CONTAINER_IMAGE_PARAMS['tag']))
DEFAULT_HEAT_API_CONTAINER = ('{}/{}heat-api:{}'.format(
DEFAULT_CONTAINER_IMAGE_PARAMS['namespace'],
DEFAULT_CONTAINER_IMAGE_PARAMS['name_prefix'],
DEFAULT_CONTAINER_IMAGE_PARAMS['tag']))
DEFAULT_HEAT_ENGINE_CONTAINER = ('{}/{}heat-engine:{}'.format(
DEFAULT_CONTAINER_IMAGE_PARAMS['namespace'],
DEFAULT_CONTAINER_IMAGE_PARAMS['name_prefix'],
DEFAULT_CONTAINER_IMAGE_PARAMS['tag']))
DEFAULT_EPHEMERAL_HEAT_CONTAINER = \
'localhost/tripleo/openstack-heat-all:ephemeral'
DEFAULT_EPHEMERAL_HEAT_API_CONTAINER = \
'localhost/tripleo/openstack-heat-api:ephemeral'
DEFAULT_EPHEMERAL_HEAT_ENGINE_CONTAINER = \
'localhost/tripleo/openstack-heat-engine:ephemeral'
USER_PARAMETERS = 'user-environments/tripleoclient-parameters.yaml'

View File

@ -560,6 +560,19 @@ class DeployOvercloud(command.Command):
self.log.info("Using ephemeral heat for stack operation")
restore_db = (parsed_args.setup_only or
parsed_args.config_download_only)
# Skip trying to pull the images if they are set to the default
# as they can't be pulled since they are tagged as localhost.
# If the images are missing for some reason, podman will still pull
# them by default, and error appropriately if needed.
if (parsed_args.heat_container_api_image ==
constants.DEFAULT_EPHEMERAL_HEAT_API_CONTAINER or
parsed_args.heat_container_engine_image ==
constants.DEFAULT_EPHEMERAL_HEAT_ENGINE_CONTAINER):
skip_heat_pull = True
else:
skip_heat_pull = parsed_args.skip_heat_pull
self.heat_launcher = utils.get_heat_launcher(
parsed_args.heat_type,
api_container_image=parsed_args.heat_container_api_image,
@ -568,7 +581,7 @@ class DeployOvercloud(command.Command):
'heat-launcher'),
use_tmp_dir=False,
rm_heat=parsed_args.rm_heat,
skip_heat_pull=parsed_args.skip_heat_pull)
skip_heat_pull=skip_heat_pull)
self.orchestration_client = \
utils.launch_heat(self.heat_launcher, restore_db=restore_db)
self.clients.orchestration = self.orchestration_client
@ -935,21 +948,21 @@ class DeployOvercloud(command.Command):
'--heat-container-api-image',
metavar='<HEAT_CONTAINER_API_IMAGE>',
dest='heat_container_api_image',
default=constants.DEFAULT_HEAT_API_CONTAINER,
default=constants.DEFAULT_EPHEMERAL_HEAT_API_CONTAINER,
help=_('The container image to use when launching the heat-api '
'process. Only used when --heat-type=pod. '
'Defaults to: {}'.format(
constants.DEFAULT_HEAT_API_CONTAINER))
constants.DEFAULT_EPHEMERAL_HEAT_API_CONTAINER))
)
parser.add_argument(
'--heat-container-engine-image',
metavar='<HEAT_CONTAINER_ENGINE_IMAGE>',
dest='heat_container_engine_image',
default=constants.DEFAULT_HEAT_ENGINE_CONTAINER,
default=constants.DEFAULT_EPHEMERAL_HEAT_ENGINE_CONTAINER,
help=_('The container image to use when launching the heat-engine '
'process. Only used when --heat-type=pod. '
'Defaults to: {}'.format(
constants.DEFAULT_HEAT_ENGINE_CONTAINER))
constants.DEFAULT_EPHEMERAL_HEAT_ENGINE_CONTAINER))
)
parser.add_argument(
'--rm-heat',