Remove cluster floating_ip_enabled default value
There shouldn't be a default value for floating_ip_enabled when creating cluster. By default, when it's not set, the cluster's floating_ip_enabled attribute should be set with the value of cluster template. It's fixed by removing the default value from Magnum API. Task: 36500 Story: 2006208 Change-Id: I4077783c6a19a413d534f77f287da587353df0af
This commit is contained in:
parent
6fe3d5d7f1
commit
e59e3e070f
@ -180,7 +180,7 @@ class Cluster(base.APIBase):
|
||||
fixed_subnet = wtypes.StringType(min_length=1, max_length=255)
|
||||
"""The fixed subnet name to attach to the Cluster"""
|
||||
|
||||
floating_ip_enabled = wsme.wsattr(types.boolean, default=True)
|
||||
floating_ip_enabled = wsme.wsattr(types.boolean)
|
||||
"""Indicates whether created clusters should have a floating ip or not."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
@ -510,7 +510,7 @@ def add_etcd_volume_env_file(env_files, cluster):
|
||||
def add_fip_env_file(env_files, cluster_template, cluster):
|
||||
lb_fip_enabled = cluster.labels.get(
|
||||
"master_lb_floating_ip_enabled",
|
||||
cluster_template.floating_ip_enabled
|
||||
cluster.floating_ip_enabled
|
||||
)
|
||||
master_lb_fip_enabled = strutils.bool_from_string(lb_fip_enabled)
|
||||
|
||||
|
@ -203,7 +203,7 @@ class TemplateDefinitionTestCase(base.TestCase):
|
||||
mock_cluster_template = mock.MagicMock(floating_ip_enabled=True,
|
||||
master_lb_enabled=True,
|
||||
labels={})
|
||||
mock_cluster = mock.MagicMock(labels={})
|
||||
mock_cluster = mock.MagicMock(floating_ip_enabled=True, labels={})
|
||||
env_files = []
|
||||
cmn_tdef.add_fip_env_file(env_files, mock_cluster_template,
|
||||
mock_cluster)
|
||||
@ -289,6 +289,28 @@ class TemplateDefinitionTestCase(base.TestCase):
|
||||
env_files
|
||||
)
|
||||
|
||||
def test_add_fip_env_lb_enable_lbfip_template_disable_cluster_enable(self):
|
||||
mock_cluster_template = mock.MagicMock(
|
||||
floating_ip_enabled=False,
|
||||
master_lb_enabled=True,
|
||||
labels={}
|
||||
)
|
||||
mock_cluster = mock.MagicMock(
|
||||
floating_ip_enabled=True,
|
||||
labels={})
|
||||
env_files = []
|
||||
|
||||
cmn_tdef.add_fip_env_file(env_files, mock_cluster_template,
|
||||
mock_cluster)
|
||||
|
||||
self.assertEqual(
|
||||
[
|
||||
cmn_tdef.COMMON_ENV_PATH + 'enable_floating_ip.yaml',
|
||||
cmn_tdef.COMMON_ENV_PATH + 'enable_lb_floating_ip.yaml'
|
||||
],
|
||||
env_files
|
||||
)
|
||||
|
||||
@mock.patch('magnum.drivers.common.driver.Driver.get_driver')
|
||||
def test_base_get_scale_params(self, mock_driver):
|
||||
mock_context = mock.MagicMock()
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
There shouldn't be a default value for floating_ip_enabled when creating
|
||||
cluster. By default, when it's not set, the cluster's floating_ip_enabled
|
||||
attribute should be set with the value of cluster template. It's fixed
|
||||
by removing the default value from Magnum API.
|
Loading…
Reference in New Issue
Block a user