From c47fde0cbe371490e7191cd637e609b7ea7a5025 Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Thu, 7 Mar 2019 16:23:17 +1300 Subject: [PATCH] Improve floating IP allocation - Never allocate floating IP for etcd service. - Introduce a new label `master_lb_floating_ip_enabled` which controls if Magnum allocates floating IP for the master load balancer. This label only takes effect when the `master_lb_enabled` is set. The default value is the same with `floating_ip_enabled`. - The `floating_ip_enabled` property now only controls if Magnum should allocate the floating IPs for the master and worker nodes. Change-Id: I0a232406deaf112b0cb9e445735d7b49206c676d Story: #2005153 Task: #29868 --- .../drivers/heat/dcos_centos_template_def.py | 2 +- doc/source/user/index.rst | 9 ++ .../environments/enable_floating_ip.yaml | 2 - .../environments/enable_lb_floating_ip.yaml | 2 + .../common/templates/{lb.yaml => lb_api.yaml} | 0 magnum/drivers/common/templates/lb_etcd.yaml | 52 +++++++++ .../drivers/heat/k8s_coreos_template_def.py | 2 +- .../drivers/heat/k8s_fedora_template_def.py | 2 +- .../drivers/heat/swarm_mode_template_def.py | 2 +- magnum/drivers/heat/template_def.py | 18 ++- .../k8s_coreos_v1/templates/kubecluster.yaml | 5 +- .../templates/kubecluster.yaml | 5 +- .../templates/kubecluster.yaml | 7 +- .../templates/mesoscluster.yaml | 4 +- .../templates/cluster.yaml | 7 +- .../templates/swarmcluster.yaml | 2 +- .../handlers/test_k8s_cluster_conductor.py | 12 +- .../unit/drivers/test_template_definition.py | 109 ++++++++++++++---- ...-floating-ip-enabled-84cd00224d6b7bc1.yaml | 10 ++ 19 files changed, 201 insertions(+), 51 deletions(-) rename magnum/drivers/common/templates/{lb.yaml => lb_api.yaml} (100%) create mode 100644 magnum/drivers/common/templates/lb_etcd.yaml create mode 100644 releasenotes/notes/k8s-improve-floating-ip-enabled-84cd00224d6b7bc1.yaml diff --git a/contrib/drivers/heat/dcos_centos_template_def.py b/contrib/drivers/heat/dcos_centos_template_def.py index bfc4fe4bf7..2d47274907 100644 --- a/contrib/drivers/heat/dcos_centos_template_def.py +++ b/contrib/drivers/heat/dcos_centos_template_def.py @@ -158,6 +158,6 @@ class DcosCentosTemplateDefinition(template_def.BaseTemplateDefinition): template_def.add_priv_net_env_file(env_files, cluster_template) template_def.add_lb_env_file(env_files, cluster_template) - template_def.add_fip_env_file(env_files, cluster_template) + template_def.add_fip_env_file(env_files, cluster_template, cluster) return env_files diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst index 8773745ca0..d46b3f3da6 100644 --- a/doc/source/user/index.rst +++ b/doc/source/user/index.rst @@ -384,6 +384,9 @@ the table are linked to more details elsewhere in the user guide. +---------------------------------------+--------------------+---------------+ | `tiller_namespace`_ | see below | see below | +---------------------------------------+--------------------+---------------+ +| `master_lb_floating_ip_enabled`_ | - true | see below | +| | - false | | ++---------------------------------------+--------------------+---------------+ Cluster ------- @@ -1232,6 +1235,12 @@ _`tiller_namespace` Configure in which namespace tiller is going to be installed. Default: magnum-tiller +_`master_lb_floating_ip_enabled` + Controls if Magnum allocates floating IP for the load balancer of master + nodes. This label only takes effect when the template property + ``master_lb_enabled`` is set. If not specified, the default value is the same + as template property ``floating_ip_enabled``. + External load balancer for services ----------------------------------- diff --git a/magnum/drivers/common/templates/environments/enable_floating_ip.yaml b/magnum/drivers/common/templates/environments/enable_floating_ip.yaml index c1c3231c2e..d9565c1c20 100644 --- a/magnum/drivers/common/templates/environments/enable_floating_ip.yaml +++ b/magnum/drivers/common/templates/environments/enable_floating_ip.yaml @@ -1,5 +1,3 @@ -# Environment file to disable FloatingIP in a Kubernetes cluster by mapping -# FloatingIP-related resource types to OS::Neutron::FloatingIP resource_registry: "Magnum::FloatingIPAddressSwitcher": "../fragments/floating_ip_address_switcher_public.yaml" diff --git a/magnum/drivers/common/templates/environments/enable_lb_floating_ip.yaml b/magnum/drivers/common/templates/environments/enable_lb_floating_ip.yaml index 9a2287ad37..2f07875ce6 100644 --- a/magnum/drivers/common/templates/environments/enable_lb_floating_ip.yaml +++ b/magnum/drivers/common/templates/environments/enable_lb_floating_ip.yaml @@ -2,3 +2,5 @@ resource_registry: "Magnum::Optional::Neutron::LBaaS::FloatingIP": "OS::Neutron::FloatingIP" + + "Magnum::FloatingIPAddressSwitcher": "../fragments/floating_ip_address_switcher_public.yaml" diff --git a/magnum/drivers/common/templates/lb.yaml b/magnum/drivers/common/templates/lb_api.yaml similarity index 100% rename from magnum/drivers/common/templates/lb.yaml rename to magnum/drivers/common/templates/lb_api.yaml diff --git a/magnum/drivers/common/templates/lb_etcd.yaml b/magnum/drivers/common/templates/lb_etcd.yaml new file mode 100644 index 0000000000..db6314568b --- /dev/null +++ b/magnum/drivers/common/templates/lb_etcd.yaml @@ -0,0 +1,52 @@ +# etcd service load balancer doesn't have floating IP associated. +heat_template_version: 2014-10-16 + +parameters: + + fixed_subnet: + type: string + + protocol: + type: string + default: TCP + constraints: + - allowed_values: ["TCP", "HTTP"] + + port: + type: number + +resources: + loadbalancer: + type: Magnum::Optional::Neutron::LBaaS::LoadBalancer + properties: + vip_subnet: {get_param: fixed_subnet} + + listener: + type: Magnum::Optional::Neutron::LBaaS::Listener + properties: + loadbalancer: {get_resource: loadbalancer} + protocol: {get_param: protocol} + protocol_port: {get_param: port} + + pool: + type: Magnum::Optional::Neutron::LBaaS::Pool + properties: + lb_algorithm: ROUND_ROBIN + listener: {get_resource: listener} + protocol: {get_param: protocol} + + monitor: + type: Magnum::Optional::Neutron::LBaaS::HealthMonitor + properties: + type: TCP + delay: 5 + max_retries: 5 + timeout: 5 + pool: { get_resource: pool } + +outputs: + pool_id: + value: {get_resource: pool} + + address: + value: {get_attr: [loadbalancer, vip_address]} diff --git a/magnum/drivers/heat/k8s_coreos_template_def.py b/magnum/drivers/heat/k8s_coreos_template_def.py index 5eb1a801fe..0393f6e541 100644 --- a/magnum/drivers/heat/k8s_coreos_template_def.py +++ b/magnum/drivers/heat/k8s_coreos_template_def.py @@ -127,6 +127,6 @@ class CoreOSK8sTemplateDefinition(k8s_template_def.K8sTemplateDefinition): template_def.add_etcd_volume_env_file(env_files, cluster_template) template_def.add_volume_env_file(env_files, cluster) template_def.add_lb_env_file(env_files, cluster_template) - template_def.add_fip_env_file(env_files, cluster_template) + template_def.add_fip_env_file(env_files, cluster_template, cluster) return env_files diff --git a/magnum/drivers/heat/k8s_fedora_template_def.py b/magnum/drivers/heat/k8s_fedora_template_def.py index 674c7b8866..721c5daa14 100644 --- a/magnum/drivers/heat/k8s_fedora_template_def.py +++ b/magnum/drivers/heat/k8s_fedora_template_def.py @@ -162,6 +162,6 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition): template_def.add_etcd_volume_env_file(env_files, cluster_template) template_def.add_volume_env_file(env_files, cluster) template_def.add_lb_env_file(env_files, cluster_template) - template_def.add_fip_env_file(env_files, cluster_template) + template_def.add_fip_env_file(env_files, cluster_template, cluster) return env_files diff --git a/magnum/drivers/heat/swarm_mode_template_def.py b/magnum/drivers/heat/swarm_mode_template_def.py index 088a218565..7a5aa27c01 100644 --- a/magnum/drivers/heat/swarm_mode_template_def.py +++ b/magnum/drivers/heat/swarm_mode_template_def.py @@ -154,6 +154,6 @@ class SwarmModeTemplateDefinition(template_def.BaseTemplateDefinition): template_def.add_priv_net_env_file(env_files, cluster_template) template_def.add_volume_env_file(env_files, cluster) template_def.add_lb_env_file(env_files, cluster_template) - template_def.add_fip_env_file(env_files, cluster_template) + template_def.add_fip_env_file(env_files, cluster_template, cluster) return env_files diff --git a/magnum/drivers/heat/template_def.py b/magnum/drivers/heat/template_def.py index e90b3b9e81..57a1668079 100755 --- a/magnum/drivers/heat/template_def.py +++ b/magnum/drivers/heat/template_def.py @@ -15,6 +15,7 @@ import abc import ast from oslo_log import log as logging +from oslo_utils import strutils import re import requests import six @@ -385,15 +386,22 @@ def add_etcd_volume_env_file(env_files, cluster_template): env_files.append(COMMON_ENV_PATH + 'with_etcd_volume.yaml') -def add_fip_env_file(env_files, cluster_template): +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 + ) + master_lb_fip_enabled = strutils.bool_from_string(lb_fip_enabled) + if cluster_template.floating_ip_enabled: env_files.append(COMMON_ENV_PATH + 'enable_floating_ip.yaml') - if cluster_template.master_lb_enabled: - env_files.append(COMMON_ENV_PATH + 'enable_lb_floating_ip.yaml') else: env_files.append(COMMON_ENV_PATH + 'disable_floating_ip.yaml') - if cluster_template.master_lb_enabled: - env_files.append(COMMON_ENV_PATH + 'disable_lb_floating_ip.yaml') + + if cluster_template.master_lb_enabled and master_lb_fip_enabled: + env_files.append(COMMON_ENV_PATH + 'enable_lb_floating_ip.yaml') + else: + env_files.append(COMMON_ENV_PATH + 'disable_lb_floating_ip.yaml') def add_priv_net_env_file(env_files, cluster_template): diff --git a/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml index 9e84549446..d7703bc3dc 100644 --- a/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml +++ b/magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml @@ -515,7 +515,7 @@ resources: private_network_name: private api_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_api.yaml properties: fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} @@ -523,10 +523,9 @@ resources: port: {get_param: kubernetes_port} etcd_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_etcd.yaml properties: fixed_subnet: {get_attr: [network, fixed_subnet]} - external_network: {get_param: external_network} protocol: {get_param: loadbalancing_protocol} port: 2379 diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml index 3003ef9e67..e0d9722862 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml +++ b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml @@ -586,7 +586,7 @@ resources: private_network_name: private api_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_api.yaml properties: fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} @@ -594,10 +594,9 @@ resources: port: {get_param: kubernetes_port} etcd_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_etcd.yaml properties: fixed_subnet: {get_attr: [network, fixed_subnet]} - external_network: {get_param: external_network} protocol: {get_param: loadbalancing_protocol} port: 2379 diff --git a/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml index 49bfd0d037..653a4892d1 100644 --- a/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml +++ b/magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml @@ -11,7 +11,7 @@ parameters: type: string description: name of ssh key to be provisioned on our server default: "" - + external_network: type: string description: uuid/name of a network to use for floating ip addresses @@ -370,7 +370,7 @@ parameters: resources: api_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_api.yaml properties: fixed_subnet: {get_param: fixed_subnet} external_network: {get_param: external_network} @@ -378,10 +378,9 @@ resources: port: {get_param: kubernetes_port} etcd_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_etcd.yaml properties: fixed_subnet: {get_param: fixed_subnet} - external_network: {get_param: external_network} protocol: {get_param: loadbalancing_protocol} port: 2379 diff --git a/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml b/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml index d008af5540..c2e7798d7e 100644 --- a/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml +++ b/magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml @@ -12,7 +12,7 @@ parameters: type: string description: name of ssh key to be provisioned on our server default: "" - + external_network: type: string description: uuid/name of a network to use for floating ip addresses @@ -242,7 +242,7 @@ resources: external_network: {get_param: external_network} api_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_api.yaml properties: fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} diff --git a/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml b/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml index b9c6eaaf32..1d0ad3c1f7 100644 --- a/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml +++ b/magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml @@ -17,7 +17,7 @@ parameters: type: string description: name of ssh key to be provisioned on our server default: "" - + external_network: type: string description: uuid/name of a network to use for floating ip addresses @@ -284,7 +284,7 @@ resources: external_network: {get_param: external_network} api_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_api.yaml properties: fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} @@ -292,10 +292,9 @@ resources: port: {get_param: swarm_port} etcd_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_etcd.yaml properties: fixed_subnet: {get_attr: [network, fixed_subnet]} - external_network: {get_param: external_network} protocol: {get_param: loadbalancing_protocol} port: 2379 diff --git a/magnum/drivers/swarm_fedora_atomic_v2/templates/swarmcluster.yaml b/magnum/drivers/swarm_fedora_atomic_v2/templates/swarmcluster.yaml index e2d8652547..4d4db3fe88 100644 --- a/magnum/drivers/swarm_fedora_atomic_v2/templates/swarmcluster.yaml +++ b/magnum/drivers/swarm_fedora_atomic_v2/templates/swarmcluster.yaml @@ -221,7 +221,7 @@ resources: external_network: {get_param: external_network} api_lb: - type: ../../common/templates/lb.yaml + type: ../../common/templates/lb_api.yaml properties: fixed_subnet: {get_attr: [network, fixed_subnet]} external_network: {get_param: external_network} diff --git a/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py b/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py index 9d86dd845d..750cce253a 100644 --- a/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py +++ b/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py @@ -304,6 +304,7 @@ class TestClusterConductorWithK8s(base.TestCase): '../../common/templates/environments/with_volume.yaml', '../../common/templates/environments/no_master_lb.yaml', '../../common/templates/environments/disable_floating_ip.yaml', + '../../common/templates/environments/disable_lb_floating_ip.yaml', ], env_files) @@ -424,6 +425,7 @@ class TestClusterConductorWithK8s(base.TestCase): '../../common/templates/environments/with_volume.yaml', '../../common/templates/environments/no_master_lb.yaml', '../../common/templates/environments/disable_floating_ip.yaml', + '../../common/templates/environments/disable_lb_floating_ip.yaml' ], env_files) @@ -532,6 +534,7 @@ class TestClusterConductorWithK8s(base.TestCase): '../../common/templates/environments/with_volume.yaml', '../../common/templates/environments/no_master_lb.yaml', '../../common/templates/environments/disable_floating_ip.yaml', + '../../common/templates/environments/disable_lb_floating_ip.yaml' ], env_files) @@ -630,7 +633,9 @@ class TestClusterConductorWithK8s(base.TestCase): '../../common/templates/environments/no_etcd_volume.yaml', '../../common/templates/environments/with_volume.yaml', '../../common/templates/environments/no_master_lb.yaml', - '../../common/templates/environments/disable_floating_ip.yaml'], + '../../common/templates/environments/disable_floating_ip.yaml', + '../../common/templates/environments/disable_lb_floating_ip.yaml' + ], env_files) @patch('requests.get') @@ -726,7 +731,9 @@ class TestClusterConductorWithK8s(base.TestCase): '../../common/templates/environments/no_etcd_volume.yaml', '../../common/templates/environments/with_volume.yaml', '../../common/templates/environments/no_master_lb.yaml', - '../../common/templates/environments/disable_floating_ip.yaml'], + '../../common/templates/environments/disable_floating_ip.yaml', + '../../common/templates/environments/disable_lb_floating_ip.yaml' + ], env_files) @patch('requests.get') @@ -970,6 +977,7 @@ class TestClusterConductorWithK8s(base.TestCase): '../../common/templates/environments/with_volume.yaml', '../../common/templates/environments/no_master_lb.yaml', '../../common/templates/environments/disable_floating_ip.yaml', + '../../common/templates/environments/disable_lb_floating_ip.yaml', ], env_files) reqget.assert_called_once_with('http://etcd/test?size=1', proxies={ diff --git a/magnum/tests/unit/drivers/test_template_definition.py b/magnum/tests/unit/drivers/test_template_definition.py index 4f99833e9e..b9a138cd88 100644 --- a/magnum/tests/unit/drivers/test_template_definition.py +++ b/magnum/tests/unit/drivers/test_template_definition.py @@ -185,39 +185,107 @@ class TemplateDefinitionTestCase(base.TestCase): def test_add_fip_env_lb_disabled_with_fp(self): mock_cluster_template = mock.MagicMock(floating_ip_enabled=True, - master_lb_enabled=False) + master_lb_enabled=False, + labels={}) + mock_cluster = mock.MagicMock(labels={}) env_files = [] - cmn_tdef.add_fip_env_file(env_files, mock_cluster_template) - self.assertEqual([cmn_tdef.COMMON_ENV_PATH + - 'enable_floating_ip.yaml'], 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 + 'disable_lb_floating_ip.yaml' + ], + env_files + ) def test_add_fip_env_lb_enabled_with_fp(self): mock_cluster_template = mock.MagicMock(floating_ip_enabled=True, - master_lb_enabled=True) + master_lb_enabled=True, + labels={}) + mock_cluster = mock.MagicMock(labels={}) env_files = [] - cmn_tdef.add_fip_env_file(env_files, mock_cluster_template) - self.assertEqual([cmn_tdef.COMMON_ENV_PATH + - 'enable_floating_ip.yaml', - cmn_tdef.COMMON_ENV_PATH + - 'enable_lb_floating_ip.yaml'], 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 + ) def test_add_fip_env_lb_disabled_without_fp(self): mock_cluster_template = mock.MagicMock(floating_ip_enabled=False, - master_lb_enabled=False) + master_lb_enabled=False, + labels={}) + mock_cluster = mock.MagicMock(labels={}) env_files = [] - cmn_tdef.add_fip_env_file(env_files, mock_cluster_template) - self.assertEqual([cmn_tdef.COMMON_ENV_PATH + - 'disable_floating_ip.yaml'], env_files) + cmn_tdef.add_fip_env_file(env_files, mock_cluster_template, + mock_cluster) + self.assertEqual( + [ + cmn_tdef.COMMON_ENV_PATH + 'disable_floating_ip.yaml', + cmn_tdef.COMMON_ENV_PATH + 'disable_lb_floating_ip.yaml' + ], + env_files + ) def test_add_fip_env_lb_enabled_without_fp(self): mock_cluster_template = mock.MagicMock(floating_ip_enabled=False, - master_lb_enabled=True) + master_lb_enabled=True, + labels={}) + mock_cluster = mock.MagicMock(labels={}) env_files = [] - cmn_tdef.add_fip_env_file(env_files, mock_cluster_template) - self.assertEqual([cmn_tdef.COMMON_ENV_PATH + - 'disable_floating_ip.yaml', - cmn_tdef.COMMON_ENV_PATH + - 'disable_lb_floating_ip.yaml'], env_files) + cmn_tdef.add_fip_env_file(env_files, mock_cluster_template, + mock_cluster) + self.assertEqual( + [ + cmn_tdef.COMMON_ENV_PATH + 'disable_floating_ip.yaml', + cmn_tdef.COMMON_ENV_PATH + 'disable_lb_floating_ip.yaml' + ], + env_files + ) + + def test_add_fip_env_lb_fip_enabled_without_fp(self): + mock_cluster_template = mock.MagicMock( + floating_ip_enabled=False, + master_lb_enabled=True, + labels={"master_lb_floating_ip_enabled": "true"} + ) + mock_cluster = mock.MagicMock( + labels={"master_lb_floating_ip_enabled": "true"}) + env_files = [] + cmn_tdef.add_fip_env_file(env_files, mock_cluster_template, + mock_cluster) + self.assertEqual( + [ + cmn_tdef.COMMON_ENV_PATH + 'disable_floating_ip.yaml', + cmn_tdef.COMMON_ENV_PATH + 'enable_lb_floating_ip.yaml' + ], + env_files + ) + + def test_add_fip_env_lb_enable_lbfip_disable(self): + mock_cluster_template = mock.MagicMock( + floating_ip_enabled=False, + master_lb_enabled=True, + labels={"master_lb_floating_ip_enabled": "false"} + ) + mock_cluster = mock.MagicMock( + labels={"master_lb_floating_ip_enabled": "false"}) + env_files = [] + + cmn_tdef.add_fip_env_file(env_files, mock_cluster_template, + mock_cluster) + + self.assertEqual( + [ + cmn_tdef.COMMON_ENV_PATH + 'disable_floating_ip.yaml', + cmn_tdef.COMMON_ENV_PATH + 'disable_lb_floating_ip.yaml' + ], + env_files + ) @mock.patch('magnum.drivers.common.driver.Driver.get_driver') def test_base_get_scale_params(self, mock_driver): @@ -247,7 +315,6 @@ class BaseK8sTemplateDefinitionTestCase(base.TestCase): private_ip_output_key='kube_masters_private', cluster_attr='master_addresses', ): - definition = self.get_definition() expected_address = expected_public_address = ['public'] diff --git a/releasenotes/notes/k8s-improve-floating-ip-enabled-84cd00224d6b7bc1.yaml b/releasenotes/notes/k8s-improve-floating-ip-enabled-84cd00224d6b7bc1.yaml new file mode 100644 index 0000000000..d943f40ece --- /dev/null +++ b/releasenotes/notes/k8s-improve-floating-ip-enabled-84cd00224d6b7bc1.yaml @@ -0,0 +1,10 @@ +upgrade: + - The etcd service for Kubernetes cluster is no longer allocated a floating + IP. +features: + - A new label named ``master_lb_floating_ip_enabled`` is introduced which + controls if Magnum allocates floating IP for the load balancer of master + nodes. This label only takes effect when the ``master_lb_enabled`` is set. + The default value is the same as ``floating_ip_enabled``. The + ``floating_ip_enabled`` property now only controls if Magnum should + allocate the floating IPs for the master and worker nodes.