Updates drivers from BayModel to ClusterTemplate

Moves magnum.drivers from using Baymodel to ClusterTemplate naming to align
with bay to cluster blueprint.
First part of the rest of magnum.drivers update, with the next part renaming
Bay to Cluster.

Change-Id: I34c5a8bb2b2617b9a057cf7063d4749fa5a39f58
Implements: blueprint rename-bay-to-cluster
changes/49/364549/2
Stephen Watson 6 years ago
parent 0b7c6401dd
commit 2c9378dbd4
  1. 18
      contrib/drivers/k8s_opensuse_v1/template_def.py
  2. 76
      magnum/drivers/common/template_def.py
  3. 34
      magnum/drivers/k8s_coreos_v1/template_def.py
  4. 67
      magnum/drivers/k8s_fedora_atomic_v1/template_def.py
  5. 18
      magnum/drivers/mesos_ubuntu_v1/template_def.py
  6. 30
      magnum/drivers/swarm_fedora_atomic_v1/template_def.py
  7. 2
      magnum/tests/unit/drivers/test_template_definition.py

@ -24,7 +24,7 @@ KUBE_INSECURE_PORT = '8080'
class K8sApiAddressOutputMapping(template_def.OutputMapping):
def set_output(self, stack, baymodel, bay):
def set_output(self, stack, cluster_template, bay):
if self.bay_attr is None:
return
@ -33,7 +33,7 @@ class K8sApiAddressOutputMapping(template_def.OutputMapping):
# TODO(yuanying): port number is hardcoded, this will be fix
protocol = 'https'
port = KUBE_SECURE_PORT
if baymodel.tls_disabled:
if cluster_template.tls_disabled:
protocol = 'http'
port = KUBE_INSECURE_PORT
@ -87,7 +87,7 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
self.add_output('kube_masters',
bay_attr='master_addresses')
def get_params(self, context, baymodel, bay, **kwargs):
def get_params(self, context, cluster_template, bay, **kwargs):
extra_params = kwargs.pop('extra_params', {})
scale_mgr = kwargs.pop('scale_manager', None)
if scale_mgr:
@ -99,22 +99,22 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
osc = self.get_osc(context)
extra_params['magnum_url'] = osc.magnum_url()
if baymodel.tls_disabled:
if cluster_template.tls_disabled:
extra_params['loadbalancing_protocol'] = 'HTTP'
extra_params['kubernetes_port'] = 8080
label_list = ['flannel_network_cidr', 'flannel_backend',
'flannel_network_subnetlen']
for label in label_list:
extra_params[label] = baymodel.labels.get(label)
extra_params[label] = cluster_template.labels.get(label)
if baymodel.registry_enabled:
if cluster_template.registry_enabled:
extra_params['swift_region'] = CONF.docker_registry.swift_region
extra_params['registry_container'] = (
CONF.docker_registry.swift_registry_container)
return super(K8sTemplateDefinition,
self).get_params(context, baymodel, bay,
self).get_params(context, cluster_template, bay,
extra_params=extra_params,
**kwargs)
@ -133,14 +133,14 @@ class JeOSK8sTemplateDefinition(K8sTemplateDefinition):
self.add_parameter('docker_volume_size',
baymodel_attr='docker_volume_size')
def get_params(self, context, baymodel, bay, **kwargs):
def get_params(self, context, cluster_template, bay, **kwargs):
extra_params = kwargs.pop('extra_params', {})
extra_params['username'] = context.user_name
extra_params['tenant_name'] = context.tenant
return super(JeOSK8sTemplateDefinition,
self).get_params(context, baymodel, bay,
self).get_params(context, cluster_template, bay,
extra_params=extra_params,
**kwargs)

@ -62,33 +62,34 @@ CONF.import_opt('trustee_domain_id', 'magnum.common.keystone', group='trust')
class ParameterMapping(object):
"""A mapping associating heat param and bay/baymodel attr.
"""A mapping associating heat param and bay/cluster_template attr.
A ParameterMapping is an association of a Heat parameter name with
an attribute on a Bay, Baymodel, or both.
an attribute on a Bay, ClusterTemplate, or both.
In the case of both baymodel_attr and bay_attr being set, the Baymodel
will be checked first and then Bay if the attribute isn't set on the
Baymodel.
In the case of both cluster_template_attr and bay_attr being set, the
ClusterTemplate will be checked first and then Bay if the attribute isn't
set on the ClusterTemplate.
Parameters can also be set as 'required'. If a required parameter
isn't set, a RequiredArgumentNotProvided exception will be raised.
"""
def __init__(self, heat_param, baymodel_attr=None,
def __init__(self, heat_param, cluster_template_attr=None,
bay_attr=None, required=False,
param_type=lambda x: x):
self.heat_param = heat_param
self.baymodel_attr = baymodel_attr
self.cluster_template_attr = cluster_template_attr
self.bay_attr = bay_attr
self.required = required
self.param_type = param_type
def set_param(self, params, baymodel, bay):
def set_param(self, params, cluster_template, bay):
value = None
if (self.baymodel_attr and
getattr(baymodel, self.baymodel_attr, None) is not None):
value = getattr(baymodel, self.baymodel_attr)
if (self.cluster_template_attr and
getattr(cluster_template, self.cluster_template_attr, None)
is not None):
value = getattr(cluster_template, self.cluster_template_attr)
elif (self.bay_attr and
getattr(bay, self.bay_attr, None) is not None):
value = getattr(bay, self.bay_attr)
@ -112,7 +113,7 @@ class OutputMapping(object):
self.bay_attr = bay_attr
self.heat_output = heat_output
def set_output(self, stack, baymodel, bay):
def set_output(self, stack, cluster_template, bay):
if self.bay_attr is None:
return
@ -268,11 +269,12 @@ class TemplateDefinition(object):
return None
def get_params(self, context, baymodel, bay, **kwargs):
"""Pulls template parameters from Baymodel and/or Bay.
def get_params(self, context, cluster_template, bay, **kwargs):
"""Pulls template parameters from ClusterTemplate and/or Bay.
:param context: Context to pull template parameters for
:param baymodel: Baymodel to pull template parameters from
:param cluster_template: ClusterTemplate to pull template parameters
from
:param bay: Bay to pull template parameters from
:param extra_params: Any extra params to be provided to the template
@ -281,45 +283,45 @@ class TemplateDefinition(object):
template_params = dict()
for mapping in self.param_mappings:
mapping.set_param(template_params, baymodel, bay)
mapping.set_param(template_params, cluster_template, bay)
if 'extra_params' in kwargs:
template_params.update(kwargs.get('extra_params'))
return template_params
def get_env_files(self, baymodel):
"""Collects stack environment files based upon Baymodel attributes.
def get_env_files(self, cluster_template):
"""Gets stack environment files based upon ClusterTemplate attributes.
Base implementation returns no files (empty list). Meant to be
overridden by subclasses.
:param baymodel: Baymodel to collect environment files for
:param cluster_template: ClusterTemplate to grab environment files for
:return: list of relative paths to environment files
"""
return []
def get_heat_param(self, bay_attr=None, baymodel_attr=None):
def get_heat_param(self, bay_attr=None, cluster_template_attr=None):
"""Returns stack param name.
Return stack param name using bay and baymodel attributes
Return stack param name using bay and cluster_template attributes
:param bay_attr bay attribute from which it maps to stack attribute
:param baymodel_attr baymodel attribute from which it maps
to stack attribute
:param cluster_template_attr cluster_template attribute from which it
maps to stack attribute
:return stack parameter name or None
"""
for mapping in self.param_mappings:
if (mapping.bay_attr == bay_attr and
mapping.baymodel_attr == baymodel_attr):
mapping.cluster_template_attr == cluster_template_attr):
return mapping.heat_param
return None
def update_outputs(self, stack, baymodel, bay):
def update_outputs(self, stack, cluster_template, bay):
for output in self.output_mappings:
output.set_output(stack, baymodel, bay)
output.set_output(stack, cluster_template, bay)
@abc.abstractproperty
def driver_module_path(self):
@ -329,10 +331,10 @@ class TemplateDefinition(object):
def template_path(self):
pass
def extract_definition(self, context, baymodel, bay, **kwargs):
def extract_definition(self, context, cluster_template, bay, **kwargs):
return (self.template_path,
self.get_params(context, baymodel, bay, **kwargs),
self.get_env_files(baymodel))
self.get_params(context, cluster_template, bay, **kwargs),
self.get_env_files(cluster_template))
class BaseTemplateDefinition(TemplateDefinition):
@ -341,18 +343,18 @@ class BaseTemplateDefinition(TemplateDefinition):
self._osc = None
self.add_parameter('ssh_key_name',
baymodel_attr='keypair_id',
cluster_template_attr='keypair_id',
required=True)
self.add_parameter('server_image',
baymodel_attr='image_id')
cluster_template_attr='image_id')
self.add_parameter('dns_nameserver',
baymodel_attr='dns_nameserver')
cluster_template_attr='dns_nameserver')
self.add_parameter('http_proxy',
baymodel_attr='http_proxy')
cluster_template_attr='http_proxy')
self.add_parameter('https_proxy',
baymodel_attr='https_proxy')
cluster_template_attr='https_proxy')
self.add_parameter('no_proxy',
baymodel_attr='no_proxy')
cluster_template_attr='no_proxy')
self.add_parameter('number_of_masters',
bay_attr='master_count')
@ -369,7 +371,7 @@ class BaseTemplateDefinition(TemplateDefinition):
self._osc = clients.OpenStackClients(context)
return self._osc
def get_params(self, context, baymodel, bay, **kwargs):
def get_params(self, context, cluster_template, bay, **kwargs):
osc = self.get_osc(context)
extra_params = kwargs.pop('extra_params', {})
@ -381,7 +383,7 @@ class BaseTemplateDefinition(TemplateDefinition):
extra_params['auth_url'] = context.auth_url
return super(BaseTemplateDefinition,
self).get_params(context, baymodel, bay,
self).get_params(context, cluster_template, bay,
extra_params=extra_params,
**kwargs)

@ -23,7 +23,7 @@ KUBE_INSECURE_PORT = '8080'
class K8sApiAddressOutputMapping(template_def.OutputMapping):
def set_output(self, stack, baymodel, bay):
def set_output(self, stack, cluster_template, bay):
if self.bay_attr is None:
return
@ -32,7 +32,7 @@ class K8sApiAddressOutputMapping(template_def.OutputMapping):
# TODO(yuanying): port number is hardcoded, this will be fix
protocol = 'https'
port = KUBE_SECURE_PORT
if baymodel.tls_disabled:
if cluster_template.tls_disabled:
protocol = 'http'
port = KUBE_INSECURE_PORT
@ -51,28 +51,28 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
def __init__(self):
super(K8sTemplateDefinition, self).__init__()
self.add_parameter('master_flavor',
baymodel_attr='master_flavor_id')
cluster_template_attr='master_flavor_id')
self.add_parameter('minion_flavor',
baymodel_attr='flavor_id')
cluster_template_attr='flavor_id')
self.add_parameter('number_of_minions',
bay_attr='node_count')
self.add_parameter('external_network',
baymodel_attr='external_network_id',
cluster_template_attr='external_network_id',
required=True)
self.add_parameter('network_driver',
baymodel_attr='network_driver')
cluster_template_attr='network_driver')
self.add_parameter('volume_driver',
baymodel_attr='volume_driver')
cluster_template_attr='volume_driver')
self.add_parameter('tls_disabled',
baymodel_attr='tls_disabled',
cluster_template_attr='tls_disabled',
required=True)
self.add_parameter('registry_enabled',
baymodel_attr='registry_enabled')
cluster_template_attr='registry_enabled')
self.add_parameter('bay_uuid',
bay_attr='uuid',
param_type=str)
self.add_parameter('insecure_registry_url',
baymodel_attr='insecure_registry')
cluster_template_attr='insecure_registry')
self.add_parameter('kube_version',
bay_attr='coe_version')
@ -88,7 +88,7 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
self.add_output('kube_masters',
bay_attr='master_addresses')
def get_params(self, context, baymodel, bay, **kwargs):
def get_params(self, context, cluster_template, bay, **kwargs):
extra_params = kwargs.pop('extra_params', {})
scale_mgr = kwargs.pop('scale_manager', None)
if scale_mgr:
@ -100,22 +100,22 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
osc = self.get_osc(context)
extra_params['magnum_url'] = osc.magnum_url()
if baymodel.tls_disabled:
if cluster_template.tls_disabled:
extra_params['loadbalancing_protocol'] = 'HTTP'
extra_params['kubernetes_port'] = 8080
label_list = ['flannel_network_cidr', 'flannel_backend',
'flannel_network_subnetlen']
for label in label_list:
extra_params[label] = baymodel.labels.get(label)
extra_params[label] = cluster_template.labels.get(label)
if baymodel.registry_enabled:
if cluster_template.registry_enabled:
extra_params['swift_region'] = CONF.docker_registry.swift_region
extra_params['registry_container'] = (
CONF.docker_registry.swift_registry_container)
return super(K8sTemplateDefinition,
self).get_params(context, baymodel, bay,
self).get_params(context, cluster_template, bay,
extra_params=extra_params,
**kwargs)
@ -129,8 +129,8 @@ class CoreOSK8sTemplateDefinition(K8sTemplateDefinition):
'coe': 'kubernetes'},
]
def get_env_files(self, baymodel):
if baymodel.master_lb_enabled:
def get_env_files(self, cluster_template):
if cluster_template.master_lb_enabled:
return [template_def.COMMON_ENV_PATH + 'with_master_lb.yaml']
else:
return [template_def.COMMON_ENV_PATH + 'no_master_lb.yaml']

@ -30,7 +30,7 @@ LOG = logging.getLogger(__name__)
class K8sApiAddressOutputMapping(template_def.OutputMapping):
def set_output(self, stack, baymodel, bay):
def set_output(self, stack, cluster_template, bay):
if self.bay_attr is None:
return
@ -39,7 +39,7 @@ class K8sApiAddressOutputMapping(template_def.OutputMapping):
# TODO(yuanying): port number is hardcoded, this will be fix
protocol = 'https'
port = KUBE_SECURE_PORT
if baymodel.tls_disabled:
if cluster_template.tls_disabled:
protocol = 'http'
port = KUBE_INSECURE_PORT
@ -61,13 +61,13 @@ class ServerAddressOutputMapping(template_def.OutputMapping):
self.bay_attr = bay_attr
self.heat_output = self.public_ip_output_key
def set_output(self, stack, baymodel, bay):
if not baymodel.floating_ip_enabled:
def set_output(self, stack, cluster_template, bay):
if not cluster_template.floating_ip_enabled:
self.heat_output = self.private_ip_output_key
LOG.debug("Using heat_output: %s", self.heat_output)
super(ServerAddressOutputMapping,
self).set_output(stack, baymodel, bay)
self).set_output(stack, cluster_template, bay)
class MasterAddressOutputMapping(ServerAddressOutputMapping):
@ -86,28 +86,28 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
def __init__(self):
super(K8sTemplateDefinition, self).__init__()
self.add_parameter('master_flavor',
baymodel_attr='master_flavor_id')
cluster_template_attr='master_flavor_id')
self.add_parameter('minion_flavor',
baymodel_attr='flavor_id')
cluster_template_attr='flavor_id')
self.add_parameter('number_of_minions',
bay_attr='node_count')
self.add_parameter('external_network',
baymodel_attr='external_network_id',
cluster_template_attr='external_network_id',
required=True)
self.add_parameter('network_driver',
baymodel_attr='network_driver')
cluster_template_attr='network_driver')
self.add_parameter('volume_driver',
baymodel_attr='volume_driver')
cluster_template_attr='volume_driver')
self.add_parameter('tls_disabled',
baymodel_attr='tls_disabled',
cluster_template_attr='tls_disabled',
required=True)
self.add_parameter('registry_enabled',
baymodel_attr='registry_enabled')
cluster_template_attr='registry_enabled')
self.add_parameter('bay_uuid',
bay_attr='uuid',
param_type=str)
self.add_parameter('insecure_registry_url',
baymodel_attr='insecure_registry')
cluster_template_attr='insecure_registry')
self.add_parameter('kube_version',
bay_attr='coe_version')
@ -125,7 +125,7 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
bay_attr='master_addresses',
mapping_type=MasterAddressOutputMapping)
def get_params(self, context, baymodel, bay, **kwargs):
def get_params(self, context, cluster_template, bay, **kwargs):
extra_params = kwargs.pop('extra_params', {})
scale_mgr = kwargs.pop('scale_manager', None)
if scale_mgr:
@ -137,22 +137,22 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
osc = self.get_osc(context)
extra_params['magnum_url'] = osc.magnum_url()
if baymodel.tls_disabled:
if cluster_template.tls_disabled:
extra_params['loadbalancing_protocol'] = 'HTTP'
extra_params['kubernetes_port'] = 8080
label_list = ['flannel_network_cidr', 'flannel_backend',
'flannel_network_subnetlen']
for label in label_list:
extra_params[label] = baymodel.labels.get(label)
extra_params[label] = cluster_template.labels.get(label)
if baymodel.registry_enabled:
if cluster_template.registry_enabled:
extra_params['swift_region'] = CONF.docker_registry.swift_region
extra_params['registry_container'] = (
CONF.docker_registry.swift_registry_container)
return super(K8sTemplateDefinition,
self).get_params(context, baymodel, bay,
self).get_params(context, cluster_template, bay,
extra_params=extra_params,
**kwargs)
@ -169,11 +169,11 @@ class AtomicK8sTemplateDefinition(K8sTemplateDefinition):
def __init__(self):
super(AtomicK8sTemplateDefinition, self).__init__()
self.add_parameter('docker_volume_size',
baymodel_attr='docker_volume_size')
cluster_template_attr='docker_volume_size')
self.add_parameter('docker_storage_driver',
baymodel_attr='docker_storage_driver')
cluster_template_attr='docker_storage_driver')
def get_params(self, context, baymodel, bay, **kwargs):
def get_params(self, context, cluster_template, bay, **kwargs):
extra_params = kwargs.pop('extra_params', {})
extra_params['username'] = context.user_name
@ -182,19 +182,19 @@ class AtomicK8sTemplateDefinition(K8sTemplateDefinition):
extra_params['region_name'] = osc.cinder_region_name()
return super(AtomicK8sTemplateDefinition,
self).get_params(context, baymodel, bay,
self).get_params(context, cluster_template, bay,
extra_params=extra_params,
**kwargs)
def get_env_files(self, baymodel):
def get_env_files(self, cluster_template):
env_files = []
if baymodel.master_lb_enabled:
if cluster_template.master_lb_enabled:
env_files.append(
template_def.COMMON_ENV_PATH + 'with_master_lb.yaml')
else:
env_files.append(
template_def.COMMON_ENV_PATH + 'no_master_lb.yaml')
if baymodel.floating_ip_enabled:
if cluster_template.floating_ip_enabled:
env_files.append(
template_def.COMMON_ENV_PATH + 'enable_floating_ip.yaml')
else:
@ -225,16 +225,16 @@ class FedoraK8sIronicTemplateDefinition(AtomicK8sTemplateDefinition):
def __init__(self):
super(FedoraK8sIronicTemplateDefinition, self).__init__()
self.add_parameter('fixed_subnet',
baymodel_attr='fixed_subnet',
cluster_template_attr='fixed_subnet',
param_type=str,
required=True)
def get_fixed_network_id(self, osc, baymodel):
def get_fixed_network_id(self, osc, cluster_template):
try:
subnet = neutronV20.find_resource_by_name_or_id(
osc.neutron(),
'subnet',
baymodel.fixed_subnet
cluster_template.fixed_subnet
)
except n_exception.NeutronException as e:
# NOTE(yuanying): NeutronCLIError doesn't have status_code
@ -252,16 +252,15 @@ class FedoraK8sIronicTemplateDefinition(AtomicK8sTemplateDefinition):
return subnet['network_id']
def get_params(self, context, baymodel, bay, **kwargs):
extra_params = kwargs.pop('extra_params', {})
def get_params(self, context, cluster_template, bay, **kwargs):
ep = kwargs.pop('extra_params', {})
osc = self.get_osc(context)
extra_params['fixed_network'] = self.get_fixed_network_id(osc,
baymodel)
ep['fixed_network'] = self.get_fixed_network_id(osc, cluster_template)
return super(FedoraK8sIronicTemplateDefinition,
self).get_params(context, baymodel, bay,
extra_params=extra_params,
self).get_params(context, cluster_template, bay,
extra_params=ep,
**kwargs)
@property

@ -26,18 +26,18 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
def __init__(self):
super(UbuntuMesosTemplateDefinition, self).__init__()
self.add_parameter('external_network',
baymodel_attr='external_network_id',
cluster_template_attr='external_network_id',
required=True)
self.add_parameter('number_of_slaves',
bay_attr='node_count')
self.add_parameter('master_flavor',
baymodel_attr='master_flavor_id')
cluster_template_attr='master_flavor_id')
self.add_parameter('slave_flavor',
baymodel_attr='flavor_id')
cluster_template_attr='flavor_id')
self.add_parameter('cluster_name',
bay_attr='name')
self.add_parameter('volume_driver',
baymodel_attr='volume_driver')
cluster_template_attr='volume_driver')
self.add_output('api_address',
bay_attr='api_address')
@ -50,7 +50,7 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
self.add_output('mesos_slaves',
bay_attr='node_addresses')
def get_params(self, context, baymodel, bay, **kwargs):
def get_params(self, context, cluster_template, bay, **kwargs):
extra_params = kwargs.pop('extra_params', {})
# HACK(apmelton) - This uses the user's bearer token, ideally
# it should be replaced with an actual trust token with only
@ -68,7 +68,7 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
'mesos_slave_executor_env_variables']
for label in label_list:
extra_params[label] = baymodel.labels.get(label)
extra_params[label] = cluster_template.labels.get(label)
scale_mgr = kwargs.pop('scale_manager', None)
if scale_mgr:
@ -77,12 +77,12 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
scale_mgr.get_removal_nodes(hosts))
return super(UbuntuMesosTemplateDefinition,
self).get_params(context, baymodel, bay,
self).get_params(context, cluster_template, bay,
extra_params=extra_params,
**kwargs)
def get_env_files(self, baymodel):
if baymodel.master_lb_enabled:
def get_env_files(self, cluster_template):
if cluster_template.master_lb_enabled:
return [template_def.COMMON_ENV_PATH + 'with_master_lb.yaml']
else:
return [template_def.COMMON_ENV_PATH + 'no_master_lb.yaml']

@ -22,7 +22,7 @@ DOCKER_PORT = '2376'
class SwarmApiAddressOutputMapping(template_def.OutputMapping):
def set_output(self, stack, baymodel, bay):
def set_output(self, stack, cluster_template, bay):
if self.bay_attr is None:
return
@ -54,23 +54,23 @@ class AtomicSwarmTemplateDefinition(template_def.BaseTemplateDefinition):
self.add_parameter('number_of_nodes',
bay_attr='node_count')
self.add_parameter('master_flavor',
baymodel_attr='master_flavor_id')
cluster_template_attr='master_flavor_id')
self.add_parameter('node_flavor',
baymodel_attr='flavor_id')
cluster_template_attr='flavor_id')
self.add_parameter('docker_volume_size',
baymodel_attr='docker_volume_size')
cluster_template_attr='docker_volume_size')
self.add_parameter('external_network',
baymodel_attr='external_network_id',
cluster_template_attr='external_network_id',
required=True)
self.add_parameter('network_driver',
baymodel_attr='network_driver')
cluster_template_attr='network_driver')
self.add_parameter('tls_disabled',
baymodel_attr='tls_disabled',
cluster_template_attr='tls_disabled',
required=True)
self.add_parameter('registry_enabled',
baymodel_attr='registry_enabled')
cluster_template_attr='registry_enabled')
self.add_parameter('docker_storage_driver',
baymodel_attr='docker_storage_driver')
cluster_template_attr='docker_storage_driver')
self.add_parameter('swarm_version',
bay_attr='coe_version')
@ -88,7 +88,7 @@ class AtomicSwarmTemplateDefinition(template_def.BaseTemplateDefinition):
self.add_output('discovery_url',
bay_attr='discovery_url')
def get_params(self, context, baymodel, bay, **kwargs):
def get_params(self, context, cluster_template, bay, **kwargs):
extra_params = kwargs.pop('extra_params', {})
extra_params['discovery_url'] = self.get_discovery_url(bay)
# HACK(apmelton) - This uses the user's bearer token, ideally
@ -101,20 +101,20 @@ class AtomicSwarmTemplateDefinition(template_def.BaseTemplateDefinition):
'flannel_network_subnetlen']
for label in label_list:
extra_params[label] = baymodel.labels.get(label)
extra_params[label] = cluster_template.labels.get(label)
if baymodel.registry_enabled:
if cluster_template.registry_enabled:
extra_params['swift_region'] = CONF.docker_registry.swift_region
extra_params['registry_container'] = (
CONF.docker_registry.swift_registry_container)
return super(AtomicSwarmTemplateDefinition,
self).get_params(context, baymodel, bay,
self).get_params(context, cluster_template, bay,
extra_params=extra_params,
**kwargs)
def get_env_files(self, baymodel):
if baymodel.master_lb_enabled:
def get_env_files(self, cluster_template):
if cluster_template.master_lb_enabled:
return [template_def.COMMON_ENV_PATH + 'with_master_lb.yaml']
else:
return [template_def.COMMON_ENV_PATH + 'no_master_lb.yaml']

@ -117,7 +117,7 @@ class TemplateDefinitionTestCase(base.TestCase):
'vm', 'coreos', 'kubernetes')
def test_required_param_not_set(self):
param = cmn_tdef.ParameterMapping('test', baymodel_attr='test',
param = cmn_tdef.ParameterMapping('test', cluster_template_attr='test',
required=True)
mock_baymodel = mock.MagicMock()
mock_baymodel.test = None

Loading…
Cancel
Save