De-duplicate the decouple-LBaaS-related files

The ApiGatewaySwitcher child template and the environment files that
enable/disable the master load balancer are identical across the bay
drivers that use them. This patch pulls them into the common directory.

Change-Id: I3c34df57f3c6487747ad896444075bf6a22725e5
Partially-Implements: blueprint decouple-lbaas
This commit is contained in:
Drago Rosson 2016-07-22 17:20:46 +00:00 committed by Rajiv Kumar
parent 2304c4babb
commit cff9ef524d
18 changed files with 48 additions and 200 deletions

View File

@ -1,12 +1,12 @@
# Environment file to disable LBaaS in a Swarm cluster by mapping
# Environment file to disable LBaaS in a cluster by mapping
# LBaaS-related resource types to OS::Heat::None
resource_registry:
"Magnum::ApiGatewaySwitcher": ../fragments/api_gateway_switcher_master.yaml
# swarmcluster.yaml
# Cluster template
"Magnum::Optional::Neutron::Pool": "OS::Heat::None"
"Magnum::Optional::Neutron::Pool::FloatingIP": "OS::Heat::None"
"Magnum::Optional::Neutron::Pool::HealthMonitor": "OS::Heat::None"
# swarmmaster.yaml
# Master node template
"Magnum::Optional::Neutron::PoolMember": "OS::Heat::None"

View File

@ -1,12 +1,12 @@
# Environment file to enable LBaaS in a Swarm cluster by mapping
# Environment file to enable LBaaS in a cluster by mapping
# LBaaS-related resource types to the real LBaaS resource types.
resource_registry:
"Magnum::ApiGatewaySwitcher": ../fragments/api_gateway_switcher_pool.yaml
# swarmcluster.yaml
# Cluster template
"Magnum::Optional::Neutron::Pool": "OS::Neutron::Pool"
"Magnum::Optional::Neutron::Pool::FloatingIP": "OS::Neutron::FloatingIP"
"Magnum::Optional::Neutron::Pool::HealthMonitor": "OS::Neutron::HealthMonitor"
# swarmmaster.yaml
# Master node template
"Magnum::Optional::Neutron::PoolMember": "OS::Neutron::PoolMember"

View File

@ -150,9 +150,9 @@ class AtomicK8sTemplateDefinition(K8sTemplateDefinition):
def get_env_files(self, baymodel):
if baymodel.master_lb_enabled:
return ['environments/with_master_lb.yaml']
return ['../../common/templates/environments/with_master_lb.yaml']
else:
return ['environments/no_master_lb.yaml']
return ['../../common/templates/environments/no_master_lb.yaml']
@property
def template_path(self):

View File

@ -1,12 +0,0 @@
# Environment file to disable LBaaS in a Kubernetes cluster by mapping
# LBaaS-related resource types to OS::Heat::None
resource_registry:
"Magnum::ApiGatewaySwitcher": ../fragments/api_gateway_switcher_master.yaml
# kubecluster.yaml
"Magnum::Optional::Neutron::Pool": "OS::Heat::None"
"Magnum::Optional::Neutron::Pool::FloatingIP": "OS::Heat::None"
"Magnum::Optional::Neutron::Pool::HealthMonitor": "OS::Heat::None"
# kubemaster.yaml
"Magnum::Optional::Neutron::PoolMember": "OS::Heat::None"

View File

@ -1,12 +0,0 @@
# Environment file to enable LBaaS in a Kubernetes cluster by mapping
# LBaaS-related resource types to the real LBaaS resource types.
resource_registry:
"Magnum::ApiGatewaySwitcher": ../fragments/api_gateway_switcher_pool.yaml
# kubecluster.yaml
"Magnum::Optional::Neutron::Pool": "OS::Neutron::Pool"
"Magnum::Optional::Neutron::Pool::FloatingIP": "OS::Neutron::FloatingIP"
"Magnum::Optional::Neutron::Pool::HealthMonitor": "OS::Neutron::HealthMonitor"
# kubemaster.yaml
"Magnum::Optional::Neutron::PoolMember": "OS::Neutron::PoolMember"

View File

@ -83,9 +83,9 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
def get_env_files(self, baymodel):
if baymodel.master_lb_enabled:
return ['environments/with_master_lb.yaml']
return ['../../common/templates/environments/with_master_lb.yaml']
else:
return ['environments/no_master_lb.yaml']
return ['../../common/templates/environments/no_master_lb.yaml']
@property
def template_path(self):

View File

@ -1,12 +0,0 @@
# Environment file to disable LBaaS in a Mesos cluster by mapping
# LBaaS-related resource types to OS::Heat::None
resource_registry:
"Magnum::ApiGatewaySwitcher": ../fragments/api_gateway_switcher_master.yaml
# mesoscluster.yaml
"Magnum::Optional::Neutron::Pool": "OS::Heat::None"
"Magnum::Optional::Neutron::Pool::FloatingIP": "OS::Heat::None"
"Magnum::Optional::Neutron::Pool::HealthMonitor": "OS::Heat::None"
# mesosmaster.yaml
"Magnum::Optional::Neutron::PoolMember": "OS::Heat::None"

View File

@ -1,12 +0,0 @@
# Environment file to enable LBaaS in a Mesos cluster by mapping
# LBaaS-related resource types to the real LBaaS resource types.
resource_registry:
"Magnum::ApiGatewaySwitcher": ../fragments/api_gateway_switcher_pool.yaml
# mesoscluster.yaml
"Magnum::Optional::Neutron::Pool": "OS::Neutron::Pool"
"Magnum::Optional::Neutron::Pool::FloatingIP": "OS::Neutron::FloatingIP"
"Magnum::Optional::Neutron::Pool::HealthMonitor": "OS::Neutron::HealthMonitor"
# mesosmaster.yaml
"Magnum::Optional::Neutron::PoolMember": "OS::Neutron::PoolMember"

View File

@ -1,32 +0,0 @@
heat_template_version: 2013-05-23
description: >
This is a template resource that accepts public and private IPs from both
a Neutron LBaaS Pool and a master node. It connects the master inputs
to its outputs, essentially acting as one state of a multiplexer.
parameters:
pool_public_ip:
type: string
default: ""
pool_private_ip:
type: string
default: ""
master_public_ip:
type: string
default: ""
master_private_ip:
type: string
default: ""
outputs:
public_ip:
value: {get_param: master_public_ip}
private_ip:
value: {get_param: master_private_ip}

View File

@ -1,32 +0,0 @@
heat_template_version: 2013-05-23
description: >
This is a template resource that accepts public and private IPs from both
a Neutron LBaaS Pool and a master node. It connects the pool inputs
to its outputs, essentially acting as one state of a multiplexer.
parameters:
pool_public_ip:
type: string
default: ""
pool_private_ip:
type: string
default: ""
master_public_ip:
type: string
default: ""
master_private_ip:
type: string
default: ""
outputs:
public_ip:
value: {get_param: pool_public_ip}
private_ip:
value: {get_param: pool_private_ip}

View File

@ -112,9 +112,9 @@ class AtomicSwarmTemplateDefinition(template_def.BaseTemplateDefinition):
def get_env_files(self, baymodel):
if baymodel.master_lb_enabled:
return ['environments/with_master_lb.yaml']
return ['../../common/templates/environments/with_master_lb.yaml']
else:
return ['environments/no_master_lb.yaml']
return ['../../common/templates/environments/no_master_lb.yaml']
@property
def template_path(self):

View File

@ -1,32 +0,0 @@
heat_template_version: 2013-05-23
description: >
This is a template resource that accepts public and private IPs from both
a Neutron LBaaS Pool and a master node. It connects the master inputs
to its outputs, essentially acting as one state of a multiplexer.
parameters:
pool_public_ip:
type: string
default: ""
pool_private_ip:
type: string
default: ""
master_public_ip:
type: string
default: ""
master_private_ip:
type: string
default: ""
outputs:
public_ip:
value: {get_param: master_public_ip}
private_ip:
value: {get_param: master_private_ip}

View File

@ -1,32 +0,0 @@
heat_template_version: 2013-05-23
description: >
This is a template resource that accepts public and private IPs from both
a Neutron LBaaS Pool and a master node. It connects the pool inputs
to its outputs, essentially acting as one state of a multiplexer.
parameters:
pool_public_ip:
type: string
default: ""
pool_private_ip:
type: string
default: ""
master_public_ip:
type: string
default: ""
master_private_ip:
type: string
default: ""
outputs:
public_ip:
value: {get_param: pool_public_ip}
private_ip:
value: {get_param: pool_private_ip}

View File

@ -177,7 +177,9 @@ class TestBayConductorWithK8s(base.TestCase):
expected.pop(mapping[missing_attr], None)
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/no_master_lb.yaml'],
env_files)
@patch('requests.get')
@patch('magnum.objects.BayModel.get_by_uuid')
@ -243,7 +245,9 @@ class TestBayConductorWithK8s(base.TestCase):
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/no_master_lb.yaml'],
env_files)
@patch('requests.get')
@patch('magnum.objects.BayModel.get_by_uuid')
@ -509,7 +513,9 @@ class TestBayConductorWithK8s(base.TestCase):
'insecure_registry_url': '10.0.0.1:5000',
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/no_master_lb.yaml'],
env_files)
reqget.assert_called_once_with('http://etcd/test?size=1')
@patch('magnum.common.short_id.generate_id')

View File

@ -121,7 +121,9 @@ class TestBayConductorWithMesos(base.TestCase):
'mesos_agent_image_providers': 'docker'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/no_master_lb.yaml'],
env_files)
@patch('magnum.objects.BayModel.get_by_uuid')
def test_extract_template_definition_only_required(
@ -165,7 +167,9 @@ class TestBayConductorWithMesos(base.TestCase):
'mesos_agent_image_providers': 'docker'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/no_master_lb.yaml'],
env_files)
@patch('magnum.objects.BayModel.get_by_uuid')
def test_extract_template_definition_with_lb(
@ -212,7 +216,9 @@ class TestBayConductorWithMesos(base.TestCase):
'mesos_agent_image_providers': 'docker'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/with_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/with_master_lb.yaml'],
env_files)
@patch('magnum.objects.BayModel.get_by_uuid')
def test_extract_template_definition_multi_master(
@ -260,7 +266,9 @@ class TestBayConductorWithMesos(base.TestCase):
'mesos_agent_image_providers': 'docker'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/with_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/with_master_lb.yaml'],
env_files)
@patch('magnum.conductor.utils.retrieve_baymodel')
@patch('oslo_config.cfg')

View File

@ -127,7 +127,9 @@ class TestBayConductorWithSwarm(base.TestCase):
'auth_url': 'http://192.168.10.10:5000/v3'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/no_master_lb.yaml'],
env_files)
@patch('requests.get')
@patch('magnum.objects.BayModel.get_by_uuid')
@ -187,7 +189,9 @@ class TestBayConductorWithSwarm(base.TestCase):
'docker_storage_driver': 'devicemapper'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/no_master_lb.yaml'],
env_files)
@patch('requests.get')
@patch('magnum.objects.BayModel.get_by_uuid')
@ -239,7 +243,9 @@ class TestBayConductorWithSwarm(base.TestCase):
'auth_url': 'http://192.168.10.10:5000/v3'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/no_master_lb.yaml'],
env_files)
@patch('requests.get')
@patch('magnum.objects.BayModel.get_by_uuid')
@ -293,7 +299,9 @@ class TestBayConductorWithSwarm(base.TestCase):
'auth_url': 'http://192.168.10.10:5000/v3'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/with_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/with_master_lb.yaml'],
env_files)
@patch('requests.get')
@patch('magnum.objects.BayModel.get_by_uuid')
@ -348,7 +356,9 @@ class TestBayConductorWithSwarm(base.TestCase):
'auth_url': 'http://192.168.10.10:5000/v3'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/with_master_lb.yaml'], env_files)
self.assertEqual(
['../../common/templates/environments/with_master_lb.yaml'],
env_files)
@patch('magnum.conductor.utils.retrieve_baymodel')
@patch('oslo_config.cfg')