Merge "Allow multimaster lb with no floating ip option"
This commit is contained in:
commit
f0dec728e7
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,7 +21,8 @@ lib64
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
!.coveragerc
|
||||
.coverage*
|
||||
cover
|
||||
cover-master
|
||||
.tox
|
||||
|
@ -0,0 +1,4 @@
|
||||
# disables the use of floating ip on the load balancer
|
||||
|
||||
resource_registry:
|
||||
"Magnum::Optional::Neutron::LBaaS::FloatingIP": "OS::Heat::None"
|
@ -0,0 +1,4 @@
|
||||
# enables the use of floating ip on the load balancer
|
||||
|
||||
resource_registry:
|
||||
"Magnum::Optional::Neutron::LBaaS::FloatingIP": "OS::Neutron::FloatingIP"
|
@ -8,7 +8,6 @@ resource_registry:
|
||||
"Magnum::Optional::Neutron::LBaaS::Listener": "OS::Neutron::LBaaS::Listener"
|
||||
"Magnum::Optional::Neutron::LBaaS::Pool": "OS::Neutron::LBaaS::Pool"
|
||||
"Magnum::Optional::Neutron::LBaaS::HealthMonitor": "OS::Neutron::LBaaS::HealthMonitor"
|
||||
"Magnum::Optional::Neutron::LBaaS::FloatingIP": "OS::Neutron::FloatingIP"
|
||||
|
||||
# Master node template
|
||||
"Magnum::Optional::Neutron::LBaaS::PoolMember": "OS::Neutron::LBaaS::PoolMember"
|
||||
|
@ -8,7 +8,6 @@ resource_registry:
|
||||
"Magnum::Optional::Neutron::LBaaS::Listener": "OS::Octavia::Listener"
|
||||
"Magnum::Optional::Neutron::LBaaS::Pool": "OS::Octavia::Pool"
|
||||
"Magnum::Optional::Neutron::LBaaS::HealthMonitor": "OS::Octavia::HealthMonitor"
|
||||
"Magnum::Optional::Neutron::LBaaS::FloatingIP": "OS::Neutron::FloatingIP"
|
||||
|
||||
# Master node template
|
||||
"Magnum::Optional::Neutron::LBaaS::PoolMember": "OS::Octavia::PoolMember"
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
. /etc/sysconfig/heat-params
|
||||
|
||||
set -x
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
@ -30,28 +31,36 @@ else
|
||||
VERIFY_CA="-k"
|
||||
fi
|
||||
|
||||
if [[ -z "${KUBE_NODE_PUBLIC_IP}" ]]; then
|
||||
KUBE_NODE_PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
|
||||
fi
|
||||
if [[ -z "${KUBE_NODE_IP}" ]]; then
|
||||
if [ -z "${KUBE_NODE_IP}" ]; then
|
||||
KUBE_NODE_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
|
||||
fi
|
||||
|
||||
sans="IP:${KUBE_NODE_PUBLIC_IP},IP:${KUBE_NODE_IP}"
|
||||
sans="IP:${KUBE_NODE_IP}"
|
||||
|
||||
if [ -z "${KUBE_NODE_PUBLIC_IP}" ]; then
|
||||
KUBE_NODE_PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
|
||||
fi
|
||||
|
||||
if [ -n "${KUBE_NODE_PUBLIC_IP}" ]; then
|
||||
sans="${sans},IP:${KUBE_NODE_PUBLIC_IP}"
|
||||
fi
|
||||
|
||||
if [ "${KUBE_NODE_PUBLIC_IP}" != "${KUBE_API_PUBLIC_ADDRESS}" ] \
|
||||
&& [ -n "${KUBE_API_PUBLIC_ADDRESS}" ]; then
|
||||
sans="${sans},IP:${KUBE_API_PUBLIC_ADDRESS}"
|
||||
fi
|
||||
|
||||
if [ "${KUBE_NODE_IP}" != "${KUBE_API_PRIVATE_ADDRESS}" ] \
|
||||
&& [ -n "${KUBE_API_PRIVATE_ADDRESS}" ]; then
|
||||
sans="${sans},IP:${KUBE_API_PRIVATE_ADDRESS}"
|
||||
fi
|
||||
|
||||
MASTER_HOSTNAME=${MASTER_HOSTNAME:-}
|
||||
if [[ -n "${MASTER_HOSTNAME}" ]]; then
|
||||
if [ -n "${MASTER_HOSTNAME}" ]; then
|
||||
sans="${sans},DNS:${MASTER_HOSTNAME}"
|
||||
fi
|
||||
|
||||
if [[ -n "${ETCD_LB_VIP}" ]]; then
|
||||
if [ -n "${ETCD_LB_VIP}" ]; then
|
||||
sans="${sans},IP:${ETCD_LB_VIP}"
|
||||
fi
|
||||
|
||||
@ -63,6 +72,7 @@ sans="${sans},IP:${KUBE_SERVICE_IP}"
|
||||
|
||||
sans="${sans},DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.cluster.local"
|
||||
|
||||
echo "sans is ${sans}"
|
||||
cert_dir=/etc/kubernetes/certs
|
||||
mkdir -p "$cert_dir"
|
||||
CA_CERT=$cert_dir/ca.crt
|
||||
|
@ -358,8 +358,12 @@ def add_etcd_volume_env_file(env_files, cluster_template):
|
||||
def add_fip_env_file(env_files, cluster_template):
|
||||
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')
|
||||
|
||||
|
||||
def add_priv_net_env_file(env_files, cluster_template):
|
||||
|
@ -170,6 +170,42 @@ class TemplateDefinitionTestCase(base.TestCase):
|
||||
self.assertIn(mock_mapping_type.return_value,
|
||||
definition.output_mappings)
|
||||
|
||||
def test_add_fip_env_lb_disabled_with_fp(self):
|
||||
mock_cluster_template = mock.MagicMock(floating_ip_enabled=True,
|
||||
master_lb_enabled=False)
|
||||
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)
|
||||
|
||||
def test_add_fip_env_lb_enabled_with_fp(self):
|
||||
mock_cluster_template = mock.MagicMock(floating_ip_enabled=True,
|
||||
master_lb_enabled=True)
|
||||
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)
|
||||
|
||||
def test_add_fip_env_lb_disabled_without_fp(self):
|
||||
mock_cluster_template = mock.MagicMock(floating_ip_enabled=False,
|
||||
master_lb_enabled=False)
|
||||
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)
|
||||
|
||||
def test_add_fip_env_lb_enabled_without_fp(self):
|
||||
mock_cluster_template = mock.MagicMock(floating_ip_enabled=False,
|
||||
master_lb_enabled=True)
|
||||
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)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseTemplateDefinitionTestCase(base.TestCase):
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
This is allowing no floating IP to be usable with a multimaster
|
||||
configuration in terms of load balancers.
|
Loading…
Reference in New Issue
Block a user