Designate integration
added 'domain_name' parameter to Cluster Template in API and CLI client. NOTE: in spec we proposed to use two domains: one for internal resolution and another for external. But we decided to use only one domain for both sides so an instance will have one hostname in the domain and two appropriate A records because it's more convenient. partial-bp: designate-integration Change-Id: Ic636d1d9d27f9f96fbfd37b7d29d8f0add44a24f
This commit is contained in:
parent
beff775d5d
commit
d41d9ad7b5
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
features:
|
||||
- Added integration of Designate for hostname resolution through dns
|
||||
servers
|
|
@ -27,7 +27,8 @@ class ClusterTemplateManager(base.ResourceManager):
|
|||
def create(self, name, plugin_name, hadoop_version, description=None,
|
||||
cluster_configs=None, node_groups=None, anti_affinity=None,
|
||||
net_id=None, default_image_id=None, use_autoconfig=None,
|
||||
shares=None, is_public=None, is_protected=None):
|
||||
shares=None, is_public=None, is_protected=None,
|
||||
domain_name=None):
|
||||
"""Create a Cluster Template."""
|
||||
|
||||
data = {
|
||||
|
@ -46,7 +47,8 @@ class ClusterTemplateManager(base.ResourceManager):
|
|||
use_autoconfig=use_autoconfig,
|
||||
shares=shares,
|
||||
is_public=is_public,
|
||||
is_protected=is_protected)
|
||||
is_protected=is_protected,
|
||||
domain_name=domain_name)
|
||||
|
||||
return self._create('/cluster-templates', data, 'cluster_template')
|
||||
|
||||
|
@ -56,7 +58,8 @@ class ClusterTemplateManager(base.ResourceManager):
|
|||
node_groups=NotUpdated, anti_affinity=NotUpdated,
|
||||
net_id=NotUpdated, default_image_id=NotUpdated,
|
||||
use_autoconfig=NotUpdated, shares=NotUpdated,
|
||||
is_public=NotUpdated, is_protected=NotUpdated):
|
||||
is_public=NotUpdated, is_protected=NotUpdated,
|
||||
domain_name=NotUpdated):
|
||||
"""Update a Cluster Template."""
|
||||
|
||||
data = {}
|
||||
|
@ -72,7 +75,8 @@ class ClusterTemplateManager(base.ResourceManager):
|
|||
use_autoconfig=use_autoconfig,
|
||||
shares=shares,
|
||||
is_public=is_public,
|
||||
is_protected=is_protected)
|
||||
is_protected=is_protected,
|
||||
domain_name=domain_name)
|
||||
|
||||
return self._update('/cluster-templates/%s' % cluster_template_id,
|
||||
data, 'cluster_template')
|
||||
|
|
|
@ -25,7 +25,7 @@ from saharaclient.osc.v1 import utils
|
|||
|
||||
CT_FIELDS = ['id', 'name', 'plugin_name', 'plugin_version', 'description',
|
||||
'node_groups', 'anti_affinity', 'use_autoconfig', 'is_default',
|
||||
'is_protected', 'is_public']
|
||||
'is_protected', 'is_public', 'domain_name']
|
||||
|
||||
|
||||
def _format_node_groups_list(node_groups):
|
||||
|
@ -132,6 +132,12 @@ class CreateClusterTemplate(command.ShowOne):
|
|||
metavar='<filename>',
|
||||
help='JSON representation of the cluster template configs'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--domain-name',
|
||||
metavar='<domain-name>',
|
||||
help='Domain name for instances of this cluster template. This '
|
||||
'option is available if \'use_designate\' config is True'
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
@ -191,7 +197,8 @@ class CreateClusterTemplate(command.ShowOne):
|
|||
cluster_configs=configs,
|
||||
shares=shares,
|
||||
is_public=parsed_args.public,
|
||||
is_protected=parsed_args.protected
|
||||
is_protected=parsed_args.protected,
|
||||
domain_name=parsed_args.domain_name
|
||||
).to_dict()
|
||||
|
||||
_format_ct_output(data)
|
||||
|
@ -424,6 +431,13 @@ class UpdateClusterTemplate(command.ShowOne):
|
|||
metavar='<filename>',
|
||||
help='JSON representation of the cluster template configs'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--domain-name',
|
||||
metavar='<domain-name>',
|
||||
default=None,
|
||||
help='Domain name for instances of this cluster template. This '
|
||||
'option is available if \'use_designate\' config is True'
|
||||
)
|
||||
parser.set_defaults(is_public=None, is_protected=None,
|
||||
use_autoconfig=None)
|
||||
return parser
|
||||
|
@ -481,7 +495,8 @@ class UpdateClusterTemplate(command.ShowOne):
|
|||
cluster_configs=configs,
|
||||
shares=shares,
|
||||
is_public=parsed_args.is_public,
|
||||
is_protected=parsed_args.is_protected
|
||||
is_protected=parsed_args.is_protected,
|
||||
domain_name=parsed_args.domain_name
|
||||
)
|
||||
|
||||
data = client.cluster_templates.update(
|
||||
|
|
|
@ -39,7 +39,8 @@ CT_INFO = {
|
|||
"id": "0647061f-ab98-4c89-84e0-30738ea55750",
|
||||
"anti_affinity": [],
|
||||
"name": "template",
|
||||
"is_protected": False
|
||||
"is_protected": False,
|
||||
"domain_name": 'domain.org.'
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,18 +84,20 @@ class TestCreateClusterTemplate(TestClusterTemplates):
|
|||
'node_group_template_id':
|
||||
'd29631fc-0fad-434b-80aa-7a3e9526f57c'}],
|
||||
plugin_name='fake', use_autoconfig=False, shares=None,
|
||||
cluster_configs=None)
|
||||
cluster_configs=None, domain_name=None)
|
||||
|
||||
def test_ct_create_all_options(self):
|
||||
arglist = ['--name', 'template', '--node-groups', 'fakeng:2',
|
||||
'--anti-affinity', 'datanode',
|
||||
'--description', 'descr',
|
||||
'--autoconfig', '--public', '--protected']
|
||||
'--autoconfig', '--public', '--protected',
|
||||
'--domain-name', 'domain.org.']
|
||||
|
||||
verifylist = [('name', 'template'),
|
||||
('node_groups', ['fakeng:2']),
|
||||
('description', 'descr'), ('autoconfig', True),
|
||||
('public', True), ('protected', True)]
|
||||
('public', True), ('protected', True),
|
||||
('domain_name', 'domain.org.')]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
|
@ -108,16 +111,17 @@ class TestCreateClusterTemplate(TestClusterTemplates):
|
|||
'node_group_template_id':
|
||||
'd29631fc-0fad-434b-80aa-7a3e9526f57c'}],
|
||||
plugin_name='fake', use_autoconfig=True, shares=None,
|
||||
cluster_configs=None)
|
||||
cluster_configs=None, domain_name='domain.org.')
|
||||
|
||||
# Check that columns are correct
|
||||
expected_columns = ('Anti affinity', 'Description', 'Id', 'Is default',
|
||||
expected_columns = ('Anti affinity', 'Description',
|
||||
'Domain name', 'Id', 'Is default',
|
||||
'Is protected', 'Is public', 'Name', 'Node groups',
|
||||
'Plugin name', 'Plugin version', 'Use autoconfig')
|
||||
self.assertEqual(expected_columns, columns)
|
||||
|
||||
# Check that data is correct
|
||||
expected_data = ('', 'Cluster template for tests',
|
||||
expected_data = ('', 'Cluster template for tests', 'domain.org.',
|
||||
'0647061f-ab98-4c89-84e0-30738ea55750', False, False,
|
||||
False, 'template', 'fakeng:2', 'fake', '0.1', True)
|
||||
self.assertEqual(expected_data, data)
|
||||
|
@ -209,14 +213,15 @@ class TestShowClusterTemplate(TestClusterTemplates):
|
|||
self.ct_mock.find_unique.assert_called_once_with(name='template')
|
||||
|
||||
# Check that columns are correct
|
||||
expected_columns = ('Anti affinity', 'Description', 'Id', 'Is default',
|
||||
expected_columns = ('Anti affinity', 'Description',
|
||||
'Domain name', 'Id', 'Is default',
|
||||
'Is protected', 'Is public', 'Name', 'Node groups',
|
||||
'Plugin name', 'Plugin version', 'Use autoconfig')
|
||||
self.assertEqual(expected_columns, columns)
|
||||
|
||||
# Check that data is correct
|
||||
expected_data = (
|
||||
'', 'Cluster template for tests',
|
||||
'', 'Cluster template for tests', 'domain.org.',
|
||||
'0647061f-ab98-4c89-84e0-30738ea55750', False, False, False,
|
||||
'template', 'fakeng:2', 'fake', '0.1', True)
|
||||
self.assertEqual(expected_data, data)
|
||||
|
@ -280,12 +285,13 @@ class TestUpdateClusterTemplate(TestClusterTemplates):
|
|||
arglist = ['template', '--name', 'template', '--node-groups',
|
||||
'fakeng:2', '--anti-affinity', 'datanode',
|
||||
'--description', 'descr', '--autoconfig-enable',
|
||||
'--public', '--protected']
|
||||
'--public', '--protected', '--domain-name', 'domain.org.']
|
||||
|
||||
verifylist = [('cluster_template', 'template'), ('name', 'template'),
|
||||
('node_groups', ['fakeng:2']),
|
||||
('description', 'descr'), ('use_autoconfig', True),
|
||||
('is_public', True), ('is_protected', True)]
|
||||
('is_public', True), ('is_protected', True),
|
||||
('domain_name', 'domain.org.')]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
|
@ -300,16 +306,17 @@ class TestUpdateClusterTemplate(TestClusterTemplates):
|
|||
{'count': 2, 'name': 'fakeng',
|
||||
'node_group_template_id':
|
||||
'd29631fc-0fad-434b-80aa-7a3e9526f57c'}],
|
||||
plugin_name='fake', use_autoconfig=True)
|
||||
plugin_name='fake', use_autoconfig=True, domain_name='domain.org.')
|
||||
|
||||
# Check that columns are correct
|
||||
expected_columns = ('Anti affinity', 'Description', 'Id', 'Is default',
|
||||
expected_columns = ('Anti affinity', 'Description',
|
||||
'Domain name', 'Id', 'Is default',
|
||||
'Is protected', 'Is public', 'Name', 'Node groups',
|
||||
'Plugin name', 'Plugin version', 'Use autoconfig')
|
||||
self.assertEqual(expected_columns, columns)
|
||||
|
||||
# Check that data is correct
|
||||
expected_data = ('', 'Cluster template for tests',
|
||||
expected_data = ('', 'Cluster template for tests', 'domain.org.',
|
||||
'0647061f-ab98-4c89-84e0-30738ea55750', False, False,
|
||||
False, 'template', 'fakeng:2', 'fake', '0.1', True)
|
||||
self.assertEqual(expected_data, data)
|
||||
|
|
|
@ -31,6 +31,7 @@ class ClusterTemplateTest(base.BaseTestCase):
|
|||
'count': 1
|
||||
},
|
||||
"use_autoconfig": False,
|
||||
"domain_name": 'domain.org.'
|
||||
}
|
||||
|
||||
update_json = {
|
||||
|
@ -46,6 +47,7 @@ class ClusterTemplateTest(base.BaseTestCase):
|
|||
'count': 1
|
||||
},
|
||||
"use_autoconfig": True,
|
||||
"domain_name": 'domain.org.'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,6 +114,7 @@ class ClusterTemplateTest(base.BaseTestCase):
|
|||
net_id=getattr(resp, "neutron_management_network", None),
|
||||
default_image_id=getattr(resp, "default_image_id", None),
|
||||
use_autoconfig=True,
|
||||
domain_name=getattr(resp, "domain_name", None)
|
||||
)
|
||||
|
||||
self.assertIsInstance(updated, ct.ClusterTemplate)
|
||||
|
@ -130,7 +133,7 @@ class ClusterTemplateTest(base.BaseTestCase):
|
|||
'hadoop_version': None, 'is_protected': None, 'is_public': None,
|
||||
'name': None, 'net_id': None,
|
||||
'node_groups': None, 'plugin_name': None, 'shares': None,
|
||||
'use_autoconfig': None}
|
||||
'use_autoconfig': None, 'domain_name': None}
|
||||
|
||||
req_json = unset_json.copy()
|
||||
req_json['neutron_management_network'] = req_json.pop('net_id')
|
||||
|
|
Loading…
Reference in New Issue