Support master_lb_enabled when creating cluster

Task: 40263
Story: 2007634

Change-Id: I59ad158753f25a56219ecaa5a55dd3f0ae67965a
This commit is contained in:
Feilong Wang 2020-07-02 14:20:55 +12:00
parent d66530fda8
commit c6b7952982
3 changed files with 16 additions and 2 deletions

View File

@ -41,6 +41,7 @@ CLUSTER_ATTRIBUTES = [
'keypair',
'api_address',
'master_addresses',
'master_lb_enabled',
'create_timeout',
'node_count',
'discovery_url',
@ -151,6 +152,13 @@ class CreateCluster(command.Command):
default=False,
help=_('The labels provided will be merged with the labels '
'configured in the specified cluster template.'))
parser.add_argument(
'--master-lb-enabled',
dest='master_lb_enabled',
action='store_true',
default=False,
help=_('Indicates whether created clusters should have '
'a loadbalancer for API.'))
return parser
@ -200,6 +208,9 @@ class CreateCluster(command.Command):
# way we avoid breaking older APIs.
args["merge_labels"] = parsed_args.merge_labels
if parsed_args.master_lb_enabled:
args["master_lb_enabled"] = parsed_args.master_lb_enabled
cluster = mag_client.clusters.create(**args)
print("Request to create cluster %s accepted"
% cluster.uuid)

View File

@ -256,7 +256,8 @@ class FakeCluster(object):
'master_flavor_id': None,
'flavor_id': 'm1.medium',
'project_id': None,
'health_status_reason': {'api': 'ok'}
'health_status_reason': {'api': 'ok'},
'master_lb_enabled': False,
}
# Overwrite default attributes.
@ -341,7 +342,8 @@ class FakeNodeGroup(object):
'is_default': False,
'stack_id': '3a369884-b6ba-484f-fake-stackb718aff',
'status': 'CREATE_COMPLETE',
'status_reason': 'None'
'status_reason': 'None',
'master_lb_enabled': False,
}
# Overwrite default attributes.

View File

@ -27,6 +27,7 @@ CREATION_ATTRIBUTES.append('fixed_network')
CREATION_ATTRIBUTES.append('fixed_subnet')
CREATION_ATTRIBUTES.append('floating_ip_enabled')
CREATION_ATTRIBUTES.append('merge_labels')
CREATION_ATTRIBUTES.append('master_lb_enabled')
class Cluster(baseunit.BaseTemplate):